text:
@testset "1.1.2.5 (a+b x^2)^p (c+d x^2)^q (e+f x^2)^r" begin
    (a, b, c, d, e, f, x, ) = @variables a b c d e f x

    #= ::Package:: =#

    #= ::Title:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^q*(e+f*x^2)^r=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^q*(e+f*x^2)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)*(c+d*x^2)^q*(e+f*x^2)^r=#

    #= ::Subsubsection::Closed:: =#
    #=q>0=#

    @test_int [(a + b*x^2)*(c + d*x^2)*(e + f*x^2)^4, x, 2, a*c*e^4*x + (1/3)*e^3*(b*c*e + a*d*e + 4*a*c*f)*x^3 + (1/5)*e^2*(2*a*f*(2*d*e + 3*c*f) + b*e*(d*e + 4*c*f))*x^5 + (2/7)*e*f*(a*f*(3*d*e + 2*c*f) + b*e*(2*d*e + 3*c*f))*x^7 + (1/9)*f^2*(a*f*(4*d*e + c*f) + 2*b*e*(3*d*e + 2*c*f))*x^9 + (1/11)*f^3*(4*b*d*e + b*c*f + a*d*f)*x^11 + (1/13)*b*d*f^4*x^13]
    @test_int [(a + b*x^2)*(c + d*x^2)*(e + f*x^2)^3, x, 2, a*c*e^3*x + (1/3)*e^2*(b*c*e + a*d*e + 3*a*c*f)*x^3 + (1/5)*e*(3*a*f*(d*e + c*f) + b*e*(d*e + 3*c*f))*x^5 + (1/7)*f*(3*b*e*(d*e + c*f) + a*f*(3*d*e + c*f))*x^7 + (1/9)*f^2*(3*b*d*e + b*c*f + a*d*f)*x^9 + (1/11)*b*d*f^3*x^11]
    @test_int [(a + b*x^2)*(c + d*x^2)*(e + f*x^2)^2, x, 2, a*c*e^2*x + (1/3)*e*(b*c*e + a*d*e + 2*a*c*f)*x^3 + (1/5)*(a*f*(2*d*e + c*f) + b*e*(d*e + 2*c*f))*x^5 + (1/7)*f*(2*b*d*e + b*c*f + a*d*f)*x^7 + (1/9)*b*d*f^2*x^9]
    @test_int [(a + b*x^2)*(c + d*x^2)*(e + f*x^2)^1, x, 2, a*c*e*x + (1/3)*(b*c*e + a*d*e + a*c*f)*x^3 + (1/5)*(b*d*e + b*c*f + a*d*f)*x^5 + (1/7)*b*d*f*x^7]
    @test_int [(a + b*x^2)*(c + d*x^2)/(e + f*x^2)^1, x, 3, -(((3*b*d*e - 3*b*c*f - 2*a*d*f)*x)/(3*f^2)) + (d*x*(a + b*x^2))/(3*f) + ((b*e - a*f)*(d*e - c*f)*atan((sqrt(f)*x)/sqrt(e)))/(sqrt(e)*f^(5/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)/(e + f*x^2)^2, x, 3, (b*(3*d*e - c*f)*x)/(2*e*f^2) - ((d*e - c*f)*x*(a + b*x^2))/(2*e*f*(e + f*x^2)) - ((b*e*(3*d*e - c*f) - a*f*(d*e + c*f))*atan((sqrt(f)*x)/sqrt(e)))/(2*e^(3/2)*f^(5/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)/(e + f*x^2)^3, x, 3, -(((d*e - c*f)*x*(a + b*x^2))/(4*e*f*(e + f*x^2)^2)) - ((b*e*(3*d*e + c*f) - a*f*(d*e + 3*c*f))*x)/(8*e^2*f^2*(e + f*x^2)) + ((b*e*(3*d*e + c*f) + a*f*(d*e + 3*c*f))*atan((sqrt(f)*x)/sqrt(e)))/(8*e^(5/2)*f^(5/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)/(e + f*x^2)^4, x, 4, -(((d*e - c*f)*x*(a + b*x^2))/(6*e*f*(e + f*x^2)^3)) - ((3*b*e*(d*e + c*f) - a*f*(d*e + 5*c*f))*x)/(24*e^2*f^2*(e + f*x^2)^2) + ((b*e*(d*e + c*f) + a*f*(d*e + 5*c*f))*x)/(16*e^3*f^2*(e + f*x^2)) + ((b*e*(d*e + c*f) + a*f*(d*e + 5*c*f))*atan((sqrt(f)*x)/sqrt(e)))/(16*e^(7/2)*f^(5/2))]

    @test_int [(a + b*x^2)*(c + d*x^2)^2*(e + f*x^2)^3, x, 2, a*c^2*e^3*x + (1/3)*c*e^2*(b*c*e + 2*a*d*e + 3*a*c*f)*x^3 + (1/5)*e*(b*c*e*(2*d*e + 3*c*f) + a*(d^2*e^2 + 6*c*d*e*f + 3*c^2*f^2))*x^5 + (1/7)*(a*f*(3*d^2*e^2 + 6*c*d*e*f + c^2*f^2) + b*e*(d^2*e^2 + 6*c*d*e*f + 3*c^2*f^2))*x^7 + (1/9)*f*(a*d*f*(3*d*e + 2*c*f) + b*(3*d^2*e^2 + 6*c*d*e*f + c^2*f^2))*x^9 + (1/11)*d*f^2*(3*b*d*e + 2*b*c*f + a*d*f)*x^11 + (1/13)*b*d^2*f^3*x^13]
    @test_int [(a + b*x^2)*(c + d*x^2)^2*(e + f*x^2)^2, x, 2, a*c^2*e^2*x + (1/3)*c*e*(b*c*e + 2*a*(d*e + c*f))*x^3 + (1/5)*(2*b*c*e*(d*e + c*f) + a*(d^2*e^2 + 4*c*d*e*f + c^2*f^2))*x^5 + (1/7)*(2*a*d*f*(d*e + c*f) + b*(d^2*e^2 + 4*c*d*e*f + c^2*f^2))*x^7 + (1/9)*d*f*(a*d*f + 2*b*(d*e + c*f))*x^9 + (1/11)*b*d^2*f^2*x^11]
    @test_int [(a + b*x^2)*(c + d*x^2)^2*(e + f*x^2)^1, x, 2, a*c^2*e*x + (1/3)*c*(b*c*e + 2*a*d*e + a*c*f)*x^3 + (1/5)*(b*c*(2*d*e + c*f) + a*d*(d*e + 2*c*f))*x^5 + (1/7)*d*(b*d*e + 2*b*c*f + a*d*f)*x^7 + (1/9)*b*d^2*f*x^9]
    @test_int [(a + b*x^2)*(c + d*x^2)^2/(e + f*x^2)^1, x, 4, -(((5*a*d*f*(3*d*e - 5*c*f) - b*(15*d^2*e^2 - 25*c*d*e*f + 8*c^2*f^2))*x)/(15*f^3)) - ((5*b*d*e - 4*b*c*f - 5*a*d*f)*x*(c + d*x^2))/(15*f^2) + (b*x*(c + d*x^2)^2)/(5*f) - ((b*e - a*f)*(d*e - c*f)^2*atan((sqrt(f)*x)/sqrt(e)))/(sqrt(e)*f^(7/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^2/(e + f*x^2)^2, x, 4, -((d*(b*e*(15*d*e - 13*c*f) - 3*a*f*(3*d*e - c*f))*x)/(6*e*f^3)) + (d*(5*b*e - 3*a*f)*x*(c + d*x^2))/(6*e*f^2) - ((b*e - a*f)*x*(c + d*x^2)^2)/(2*e*f*(e + f*x^2)) + ((d*e - c*f)*(b*e*(5*d*e - c*f) - a*f*(3*d*e + c*f))*atan((sqrt(f)*x)/sqrt(e)))/(2*e^(3/2)*f^(7/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^2/(e + f*x^2)^3, x, 4, (d*(b*e*(15*d*e - c*f) - 3*a*f*(d*e + c*f))*x)/(8*e^2*f^3) - ((b*e - a*f)*x*(c + d*x^2)^2)/(4*e*f*(e + f*x^2)^2) - ((b*e*(5*d*e - c*f) - a*f*(d*e + 3*c*f))*x*(c + d*x^2))/(8*e^2*f^2*(e + f*x^2)) - ((b*e*(15*d^2*e^2 - 6*c*d*e*f - c^2*f^2) - a*f*(3*d^2*e^2 + 2*c*d*e*f + 3*c^2*f^2))*atan((sqrt(f)*x)/sqrt(e)))/(8*e^(5/2)*f^(7/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^2/(e + f*x^2)^4, x, 4, -(((b*e - a*f)*x*(c + d*x^2)^2)/(6*e*f*(e + f*x^2)^3)) - ((d*e*(5*b*e + a*f) - c*f*(b*e + 5*a*f))*x*(c + d*x^2))/(24*e^2*f^2*(e + f*x^2)^2) - ((a*f*(3*d^2*e^2 + 4*c*d*e*f - 15*c^2*f^2) + b*e*(15*d^2*e^2 - 4*c*d*e*f - 3*c^2*f^2))*x)/(48*e^3*f^3*(e + f*x^2)) + ((b*e*(5*d^2*e^2 + 2*c*d*e*f + c^2*f^2) + a*f*(d^2*e^2 + 2*c*d*e*f + 5*c^2*f^2))*atan((sqrt(f)*x)/sqrt(e)))/(16*e^(7/2)*f^(7/2))]

    @test_int [(a + b*x^2)*(c + d*x^2)^3*(e + f*x^2)^3, x, 2, a*c^3*e^3*x + (1/3)*c^2*e^2*(b*c*e + 3*a*(d*e + c*f))*x^3 + (3/5)*c*e*(b*c*e*(d*e + c*f) + a*(d^2*e^2 + 3*c*d*e*f + c^2*f^2))*x^5 + (1/7)*(3*b*c*e*(d^2*e^2 + 3*c*d*e*f + c^2*f^2) + a*(d^3*e^3 + 9*c*d^2*e^2*f + 9*c^2*d*e*f^2 + c^3*f^3))*x^7 + (1/9)*(3*a*d*f*(d^2*e^2 + 3*c*d*e*f + c^2*f^2) + b*(d^3*e^3 + 9*c*d^2*e^2*f + 9*c^2*d*e*f^2 + c^3*f^3))*x^9 + (3/11)*d*f*(a*d*f*(d*e + c*f) + b*(d^2*e^2 + 3*c*d*e*f + c^2*f^2))*x^11 + (1/13)*d^2*f^2*(a*d*f + 3*b*(d*e + c*f))*x^13 + (1/15)*b*d^3*f^3*x^15]
    @test_int [(a + b*x^2)*(c + d*x^2)^3*(e + f*x^2)^2, x, 2, a*c^3*e^2*x + (1/3)*c^2*e*(b*c*e + 3*a*d*e + 2*a*c*f)*x^3 + (1/5)*c*(b*c*e*(3*d*e + 2*c*f) + a*(3*d^2*e^2 + 6*c*d*e*f + c^2*f^2))*x^5 + (1/7)*(b*c*(3*d^2*e^2 + 6*c*d*e*f + c^2*f^2) + a*d*(d^2*e^2 + 6*c*d*e*f + 3*c^2*f^2))*x^7 + (1/9)*d*(a*d*f*(2*d*e + 3*c*f) + b*(d^2*e^2 + 6*c*d*e*f + 3*c^2*f^2))*x^9 + (1/11)*d^2*f*(2*b*d*e + 3*b*c*f + a*d*f)*x^11 + (1/13)*b*d^3*f^2*x^13]
    @test_int [(a + b*x^2)*(c + d*x^2)^3*(e + f*x^2)^1, x, 2, a*c^3*e*x + (1/3)*c^2*(b*c*e + 3*a*d*e + a*c*f)*x^3 + (1/5)*c*(3*a*d*(d*e + c*f) + b*c*(3*d*e + c*f))*x^5 + (1/7)*d*(3*b*c*(d*e + c*f) + a*d*(d*e + 3*c*f))*x^7 + (1/9)*d^2*(b*d*e + 3*b*c*f + a*d*f)*x^9 + (1/11)*b*d^3*f*x^11]
    @test_int [(a + b*x^2)*(c + d*x^2)^3/(e + f*x^2)^1, x, 5, ((7*a*d*f*(15*d^2*e^2 - 40*c*d*e*f + 33*c^2*f^2) - b*(105*d^3*e^3 - 280*c*d^2*e^2*f + 231*c^2*d*e*f^2 - 48*c^3*f^3))*x)/(105*f^4) - ((7*a*d*f*(5*d*e - 9*c*f) - b*(35*d^2*e^2 - 63*c*d*e*f + 24*c^2*f^2))*x*(c + d*x^2))/(105*f^3) - ((7*b*d*e - 6*b*c*f - 7*a*d*f)*x*(c + d*x^2)^2)/(35*f^2) + (b*x*(c + d*x^2)^3)/(7*f) + ((b*e - a*f)*(d*e - c*f)^3*atan((sqrt(f)*x)/sqrt(e)))/(sqrt(e)*f^(9/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^3/(e + f*x^2)^2, x, 5, -((d*(5*a*f*(15*d^2*e^2 - 22*c*d*e*f + 3*c^2*f^2) - b*e*(105*d^2*e^2 - 190*c*d*e*f + 81*c^2*f^2))*x)/(30*e*f^4)) - (d*(b*e*(35*d*e - 33*c*f) - 5*a*f*(5*d*e - 3*c*f))*x*(c + d*x^2))/(30*e*f^3) + (d*(7*b*e - 5*a*f)*x*(c + d*x^2)^2)/(10*e*f^2) - ((b*e - a*f)*x*(c + d*x^2)^3)/(2*e*f*(e + f*x^2)) - ((d*e - c*f)^2*(b*e*(7*d*e - c*f) - a*f*(5*d*e + c*f))*atan((sqrt(f)*x)/sqrt(e)))/(2*e^(3/2)*f^(9/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^3/(e + f*x^2)^3, x, 5, (d*(3*a*f*(15*d^2*e^2 - 4*c*d*e*f - 3*c^2*f^2) - b*e*(105*d^2*e^2 - 100*c*d*e*f + 3*c^2*f^2))*x)/(24*e^2*f^4) + (d*(b*e*(35*d*e - 3*c*f) - 3*a*f*(5*d*e + 3*c*f))*x*(c + d*x^2))/(24*e^2*f^3) - ((b*e - a*f)*x*(c + d*x^2)^3)/(4*e*f*(e + f*x^2)^2) - ((b*e*(7*d*e - c*f) - 3*a*f*(d*e + c*f))*x*(c + d*x^2)^2)/(8*e^2*f^2*(e + f*x^2)) + ((d*e - c*f)*(b*e*(35*d^2*e^2 - 10*c*d*e*f - c^2*f^2) - 3*a*f*(5*d^2*e^2 + 2*c*d*e*f + c^2*f^2))*atan((sqrt(f)*x)/sqrt(e)))/(8*e^(5/2)*f^(9/2))]
    @test_int [(a + b*x^2)*(c + d*x^2)^3/(e + f*x^2)^4, x, 5, (d*(b*e*(105*d^2*e^2 - 10*c*d*e*f - 3*c^2*f^2) - a*f*(15*d^2*e^2 + 14*c*d*e*f + 15*c^2*f^2))*x)/(48*e^3*f^4) - ((b*e - a*f)*x*(c + d*x^2)^3)/(6*e*f*(e + f*x^2)^3) - ((b*e*(7*d*e - c*f) - a*f*(d*e + 5*c*f))*x*(c + d*x^2)^2)/(24*e^2*f^2*(e + f*x^2)^2) - ((b*e*(35*d^2*e^2 - 8*c*d*e*f - 3*c^2*f^2) - a*f*(5*d^2*e^2 + 4*c*d*e*f + 15*c^2*f^2))*x*(c + d*x^2))/(48*e^3*f^3*(e + f*x^2)) - ((b*e*(35*d^3*e^3 - 15*c*d^2*e^2*f - 3*c^2*d*e*f^2 - c^3*f^3) - a*f*(5*d^3*e^3 + 3*c*d^2*e^2*f + 3*c^2*d*e*f^2 + 5*c^3*f^3))*atan((sqrt(f)*x)/sqrt(e)))/(16*e^(7/2)*f^(9/2))]

    #= ::Subsubsection:: =#
    #=q<0=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2)*(e+f*x^2)=#

    #= ::Subsubsection::Closed:: =#
    #=p>0=#

    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)*(c + d*x^2)^(3/2), x, 7, -(((7*a*d*f*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2) - b*(8*d^3*e^3 - 19*c*d^2*e^2*f + 9*c^2*d*e*f^2 - 6*c^3*f^3))*x*sqrt(c + d*x^2))/(105*d^2*f^2*sqrt(e + f*x^2))) + ((7*a*d*f*(d*e + 3*c*f) - b*(4*d^2*e^2 - 6*c*d*e*f + 6*c^2*f^2))*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(105*d*f^2) + ((b*d*e - 2*b*c*f + 7*a*d*f)*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(35*d*f) + (b*x*(c + d*x^2)^(5/2)*sqrt(e + f*x^2))/(7*d) + (sqrt(e)*(7*a*d*f*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2) - b*(8*d^3*e^3 - 19*c*d^2*e^2*f + 9*c^2*d*e*f^2 - 6*c^3*f^3))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*d^2*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (e^(3/2)*(7*a*d*f*(d*e - 9*c*f) - b*(4*d^2*e^2 - 9*c*d*e*f - 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*d*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)*(c + d*x^2)^(1/2), x, 6, ((5*a*d*f*(d*e + c*f) - 2*b*(d^2*e^2 - c*d*e*f + c^2*f^2))*x*sqrt(c + d*x^2))/(15*d^2*f*sqrt(e + f*x^2)) + ((b*d*e - 2*b*c*f + 5*a*d*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*d*f) + (b*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*d) - (sqrt(e)*(5*a*d*f*(d*e + c*f) - 2*b*(d^2*e^2 - c*d*e*f + c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*d^2*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (e^(3/2)*(b*d*e + b*c*f - 10*a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*d*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)/(c + d*x^2)^(1/2), x, 5, ((b*d*e - 2*b*c*f + 3*a*d*f)*x*sqrt(c + d*x^2))/(3*d^2*sqrt(e + f*x^2)) + (b*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*d) - (sqrt(e)*(b*d*e - 2*b*c*f + 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*d^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - ((b*c - 3*a*d)*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c*d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)/(c + d*x^2)^(3/2), x, 5, ((2*b*c - a*d)*f*x*sqrt(c + d*x^2))/(c*d^2*sqrt(e + f*x^2)) - ((b*c - a*d)*x*sqrt(e + f*x^2))/(c*d*sqrt(c + d*x^2)) - ((2*b*c - a*d)*sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*d^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)/(c + d*x^2)^(5/2), x, 4, -(((b*c - a*d)*x*sqrt(e + f*x^2))/(3*c*d*(c + d*x^2)^(3/2))) + ((d*(b*c + 2*a*d)*e - c*(2*b*c + a*d)*f)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(3*c^(3/2)*d^(3/2)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + ((b*c - a*d)*e^(3/2)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*d*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(1/2)/(c + d*x^2)^(7/2), x, 5, -(((b*c - a*d)*x*sqrt(e + f*x^2))/(5*c*d*(c + d*x^2)^(5/2))) + ((a*d*(4*d*e - 3*c*f) + b*c*(d*e - 2*c*f))*x*sqrt(e + f*x^2))/(15*c^2*d*(d*e - c*f)*(c + d*x^2)^(3/2)) + ((2*b*c*(d^2*e^2 - c*d*e*f + c^2*f^2) + a*d*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(15*c^(5/2)*d^(3/2)*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (e^(3/2)*sqrt(f)*(2*a*d*(2*d*e - 3*c*f) + b*c*(d*e + c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c^3*d*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)*(c + d*x^2)^(1/2), x, 7, ((7*a*d*f*(3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2) - b*(6*d^3*e^3 - 9*c*d^2*e^2*f + 19*c^2*d*e*f^2 - 8*c^3*f^3))*x*sqrt(c + d*x^2))/(105*d^3*f*sqrt(e + f*x^2)) + ((14*a*d*f*(3*d*e - c*f) + b*(3*d^2*e^2 - 15*c*d*e*f + 8*c^2*f^2))*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(105*d^2*f) + ((3*b*d*e - 4*b*c*f + 7*a*d*f)*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(35*d^2) + (b*x*(c + d*x^2)^(3/2)*(e + f*x^2)^(3/2))/(7*d) - (sqrt(e)*(7*a*d*f*(3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2) - b*(6*d^3*e^3 - 9*c*d^2*e^2*f + 19*c^2*d*e*f^2 - 8*c^3*f^3))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*d^3*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(7*a*d*f*(9*d*e - c*f) - b*(3*d^2*e^2 + 9*c*d*e*f - 4*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*d^2*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)/(c + d*x^2)^(1/2), x, 6, ((10*a*d*f*(2*d*e - c*f) + b*(3*d^2*e^2 - 13*c*d*e*f + 8*c^2*f^2))*x*sqrt(c + d*x^2))/(15*d^3*sqrt(e + f*x^2)) + ((3*b*d*e - 4*b*c*f + 5*a*d*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*d^2) + (b*x*sqrt(c + d*x^2)*(e + f*x^2)^(3/2))/(5*d) - (sqrt(e)*(10*a*d*f*(2*d*e - c*f) + b*(3*d^2*e^2 - 13*c*d*e*f + 8*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*d^3*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(5*a*d*(3*d*e - c*f) - b*(6*c*d*e - 4*c^2*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c*d^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)/(c + d*x^2)^(3/2), x, 6, (f*(b*c*(7*d*e - 8*c*f) - 3*a*d*(d*e - 2*c*f))*x*sqrt(c + d*x^2))/(3*c*d^3*sqrt(e + f*x^2)) + ((4*b*c - 3*a*d)*f*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*c*d^2) - ((b*c - a*d)*x*(e + f*x^2)^(3/2))/(c*d*sqrt(c + d*x^2)) - (sqrt(e)*sqrt(f)*(b*c*(7*d*e - 8*c*f) - 3*a*d*(d*e - 2*c*f))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c*d^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(3*b*d*e - 4*b*c*f + 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c*d^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)/(c + d*x^2)^(5/2), x, 6, -((f*(b*c*(d*e - 8*c*f) + 2*a*d*(d*e + c*f))*x*sqrt(c + d*x^2))/(3*c^2*d^3*sqrt(e + f*x^2))) + ((b*c*(d*e - 4*c*f) + a*d*(2*d*e + c*f))*x*sqrt(e + f*x^2))/(3*c^2*d^2*sqrt(c + d*x^2)) - ((b*c - a*d)*x*(e + f*x^2)^(3/2))/(3*c*d*(c + d*x^2)^(3/2)) + (sqrt(e)*sqrt(f)*(b*c*(d*e - 8*c*f) + 2*a*d*(d*e + c*f))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*d^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((4*b*c - a*d)*e^(3/2)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*d^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)/(c + d*x^2)^(7/2), x, 5, ((d*(b*c + 4*a*d)*e - c*(4*b*c + a*d)*f)*x*sqrt(e + f*x^2))/(15*c^2*d^2*(c + d*x^2)^(3/2)) - ((b*c - a*d)*x*(e + f*x^2)^(3/2))/(5*c*d*(c + d*x^2)^(5/2)) + ((b*c*(2*d^2*e^2 + 3*c*d*e*f - 8*c^2*f^2) + a*d*(8*d^2*e^2 - 3*c*d*e*f - 2*c^2*f^2))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(15*c^(5/2)*d^(5/2)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (e^(3/2)*sqrt(f)*(b*c*(d*e - 4*c*f) + a*d*(4*d*e - c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c^3*d^2*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)*(e + f*x^2)^(3/2)/(c + d*x^2)^(9/2), x, 6, ((d*(b*c + 6*a*d)*e - c*(4*b*c + 3*a*d)*f)*x*sqrt(e + f*x^2))/(35*c^2*d^2*(c + d*x^2)^(5/2)) + ((b*c*(4*d^2*e^2 + c*d*e*f - 8*c^2*f^2) + 3*a*d*(8*d^2*e^2 - 5*c*d*e*f - 2*c^2*f^2))*x*sqrt(e + f*x^2))/(105*c^3*d^2*(d*e - c*f)*(c + d*x^2)^(3/2)) - ((b*c - a*d)*x*(e + f*x^2)^(3/2))/(7*c*d*(c + d*x^2)^(7/2)) + ((6*a*d*(8*d^3*e^3 - 12*c*d^2*e^2*f + 2*c^2*d*e*f^2 + c^3*f^3) + b*c*(8*d^3*e^3 - 5*c*d^2*e^2*f - 5*c^2*d*e*f^2 + 8*c^3*f^3))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(105*c^(7/2)*d^(5/2)*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (e^(3/2)*sqrt(f)*(3*a*d*(8*d^2*e^2 - 11*c*d*e*f + c^2*f^2) + 2*b*c*(2*d^2*e^2 - c*d*e*f + 2*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*c^4*d^2*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)*(c + d*x^2)^(5/2), x, 7, ((7*a*d*f*(8*d^2*e^2 - 23*c*d*e*f + 23*c^2*f^2) - b*(48*d^3*e^3 - 128*c*d^2*e^2*f + 103*c^2*d*e*f^2 - 15*c^3*f^3))*x*sqrt(c + d*x^2))/(105*d*f^3*sqrt(e + f*x^2)) - ((28*a*d*f*(d*e - 2*c*f) - b*(24*d^2*e^2 - 43*c*d*e*f + 15*c^2*f^2))*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(105*f^3) - ((6*b*d*e - 5*b*c*f - 7*a*d*f)*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(35*f^2) + (b*x*(c + d*x^2)^(5/2)*sqrt(e + f*x^2))/(7*f) - (sqrt(e)*(7*a*d*f*(8*d^2*e^2 - 23*c*d*e*f + 23*c^2*f^2) - b*(48*d^3*e^3 - 128*c*d^2*e^2*f + 103*c^2*d*e*f^2 - 15*c^3*f^3))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*d*f^(7/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(e)*(7*a*f*(4*d^2*e^2 - 11*c*d*e*f + 15*c^2*f^2) - b*e*(24*d^2*e^2 - 61*c*d*e*f + 45*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(105*f^(7/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)*(c + d*x^2)^(3/2), x, 6, -(((10*a*d*f*(d*e - 2*c*f) - b*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2))*x*sqrt(c + d*x^2))/(15*d*f^2*sqrt(e + f*x^2))) - ((4*b*d*e - 3*b*c*f - 5*a*d*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*f^2) + (b*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*f) + (sqrt(e)*(10*a*d*f*(d*e - 2*c*f) - b*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*d*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(5*a*f*(d*e - 3*c*f) - b*(4*d*e^2 - 6*c*e*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)*(c + d*x^2)^(1/2), x, 5, -(((2*b*d*e - b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*d*f*sqrt(e + f*x^2))) + (b*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*f) + (sqrt(e)*(2*b*d*e - b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*d*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(b*e - 3*a*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)/(c + d*x^2)^(1/2), x, 4, (b*x*sqrt(c + d*x^2))/(d*sqrt(e + f*x^2)) - (b*sqrt(e)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (a*sqrt(e)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)/(c + d*x^2)^(3/2), x, 3, -(((b*c - a*d)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*sqrt(d)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))) + (sqrt(e)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*sqrt(f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)/(c + d*x^2)^(5/2), x, 4, -(((b*c - a*d)*x*sqrt(e + f*x^2))/(3*c*(d*e - c*f)*(c + d*x^2)^(3/2))) + ((2*a*d*(d*e - 2*c*f) + b*c*(d*e + c*f))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(3*c^(3/2)*sqrt(d)*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (sqrt(e)*sqrt(f)*(2*b*c*e + a*d*e - 3*a*c*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(1/2)/(c + d*x^2)^(7/2), x, 5, -(((b*c - a*d)*x*sqrt(e + f*x^2))/(5*c*(d*e - c*f)*(c + d*x^2)^(5/2))) + ((4*a*d*(d*e - 2*c*f) + b*c*(d*e + 3*c*f))*x*sqrt(e + f*x^2))/(15*c^2*(d*e - c*f)^2*(c + d*x^2)^(3/2)) + ((b*c*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2) + a*d*(8*d^2*e^2 - 23*c*d*e*f + 23*c^2*f^2))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(15*c^(5/2)*sqrt(d)*(d*e - c*f)^3*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (sqrt(e)*sqrt(f)*(b*c*e*(d*e - 9*c*f) + a*(4*d^2*e^2 - 11*c*d*e*f + 15*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c^3*(d*e - c*f)^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)*(c + d*x^2)^(5/2), x, 7, -(((5*a*f*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2) - 2*b*e*(24*d^2*e^2 - 44*c*d*e*f + 19*c^2*f^2))*x*sqrt(c + d*x^2))/(15*e*f^3*sqrt(e + f*x^2))) - ((b*e - a*f)*x*(c + d*x^2)^(5/2))/(e*f*sqrt(e + f*x^2)) - (d*(b*e*(24*d*e - 23*c*f) - 5*a*f*(4*d*e - 3*c*f))*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*e*f^3) + (d*(6*b*e - 5*a*f)*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*e*f^2) + ((5*a*f*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2) - 2*b*e*(24*d^2*e^2 - 44*c*d*e*f + 19*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*sqrt(e)*f^(7/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(10*a*d*f*(2*d*e - 3*c*f) - b*(24*d^2*e^2 - 41*c*d*e*f + 15*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*f^(7/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)*(c + d*x^2)^(3/2), x, 6, -(((b*e*(8*d*e - 7*c*f) - 3*a*f*(2*d*e - c*f))*x*sqrt(c + d*x^2))/(3*e*f^2*sqrt(e + f*x^2))) - ((b*e - a*f)*x*(c + d*x^2)^(3/2))/(e*f*sqrt(e + f*x^2)) + (d*(4*b*e - 3*a*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*e*f^2) + ((b*e*(8*d*e - 7*c*f) - 3*a*f*(2*d*e - c*f))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*sqrt(e)*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(4*b*d*e - 3*b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*f^(5/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)*(c + d*x^2)^(1/2), x, 5, -(((b*e - a*f)*x*sqrt(c + d*x^2))/(e*f*sqrt(e + f*x^2))) + ((2*b*e - a*f)*x*sqrt(c + d*x^2))/(e*f*sqrt(e + f*x^2)) - ((2*b*e - a*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(sqrt(e)*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b*sqrt(e)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)/(c + d*x^2)^(1/2), x, 3, ((b*e - a*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(sqrt(e)*sqrt(f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - ((b*c - a*d)*sqrt(e)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*sqrt(f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)/(c + d*x^2)^(3/2), x, 4, -(((b*c - a*d)*x)/(c*(d*e - c*f)*sqrt(c + d*x^2)*sqrt(e + f*x^2))) - (sqrt(f)*(2*b*c*e - a*d*e - a*c*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*sqrt(e)*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(e)*(b*d*e + b*c*f - 2*a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*sqrt(f)*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(a + b*x^2)/(e + f*x^2)^(3/2)/(c + d*x^2)^(5/2), x, 5, -(((b*c - a*d)*x)/(3*c*(d*e - c*f)*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))) + ((2*a*d*(d*e - 3*c*f) + b*c*(d*e + 3*c*f))*x)/(3*c^2*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt(e + f*x^2)) + (sqrt(f)*(b*c*e*(d*e + 7*c*f) + a*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*sqrt(e)*(d*e - c*f)^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*sqrt(f)*(a*d*(d*e - 9*c*f) + b*c*(5*d*e + 3*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(d*e - c*f)^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    @test_int [(e + f*x^2)/(sqrt(a + b*x^2)*(c + d*x^2)^(3/2)), x, 3, -(((d*e - c*f)*sqrt(a + b*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (b*c)/(a*d)))/(sqrt(c)*sqrt(d)*(b*c - a*d)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2))) + (sqrt(c)*(b*e - a*f)*sqrt(a + b*x^2)*Elliptic.F(atan((sqrt(d)*x)/sqrt(c)), 1 - (b*c)/(a*d)))/(a*sqrt(d)*(b*c - a*d)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2))]
    @test_int [(e + f*x^2)/(sqrt(a - b*x^2)*(c + d*x^2)^(3/2)), x, 8, ((d*e - c*f)*x*sqrt(a - b*x^2))/(c*(b*c + a*d)*sqrt(c + d*x^2)) + (sqrt(a)*sqrt(b)*(d*e - c*f)*sqrt(1 - (b*x^2)/a)*sqrt(c + d*x^2)*Elliptic.E(asin((sqrt(b)*x)/sqrt(a)), -((a*d)/(b*c))))/(c*d*(b*c + a*d)*sqrt(a - b*x^2)*sqrt(1 + (d*x^2)/c)) + (sqrt(a)*f*sqrt(1 - (b*x^2)/a)*sqrt(1 + (d*x^2)/c)*Elliptic.F(asin((sqrt(b)*x)/sqrt(a)), -((a*d)/(b*c))))/(sqrt(b)*d*sqrt(a - b*x^2)*sqrt(c + d*x^2))]
    @test_int [(e + f*x^2)/(sqrt(a + b*x^2)*(c - d*x^2)^(3/2)), x, 8, ((d*e + c*f)*x*sqrt(a + b*x^2))/(c*(b*c + a*d)*sqrt(c - d*x^2)) - ((d*e + c*f)*sqrt(a + b*x^2)*sqrt(1 - (d*x^2)/c)*Elliptic.E(asin((sqrt(d)*x)/sqrt(c)), -((b*c)/(a*d))))/(sqrt(c)*sqrt(d)*(b*c + a*d)*sqrt(1 + (b*x^2)/a)*sqrt(c - d*x^2)) + (e*sqrt(1 + (b*x^2)/a)*sqrt(1 - (d*x^2)/c)*Elliptic.F(asin((sqrt(d)*x)/sqrt(c)), -((b*c)/(a*d))))/(sqrt(c)*sqrt(d)*sqrt(a + b*x^2)*sqrt(c - d*x^2))]
    @test_int [(e + f*x^2)/(sqrt(a - b*x^2)*(c - d*x^2)^(3/2)), x, 8, -(((d*e + c*f)*x*sqrt(a - b*x^2))/(c*(b*c - a*d)*sqrt(c - d*x^2))) + ((d*e + c*f)*sqrt(a - b*x^2)*sqrt(1 - (d*x^2)/c)*Elliptic.E(asin((sqrt(d)*x)/sqrt(c)), (b*c)/(a*d)))/(sqrt(c)*sqrt(d)*(b*c - a*d)*sqrt(1 - (b*x^2)/a)*sqrt(c - d*x^2)) + (e*sqrt(1 - (b*x^2)/a)*sqrt(1 - (d*x^2)/c)*Elliptic.F(asin((sqrt(d)*x)/sqrt(c)), (b*c)/(a*d)))/(sqrt(c)*sqrt(d)*sqrt(a - b*x^2)*sqrt(c - d*x^2))]

    @test_int [(a + b*x^2)/(sqrt(2 + d*x^2)*sqrt(3 + f*x^2)), x, 4, (b*x*sqrt(2 + d*x^2))/(d*sqrt(3 + f*x^2)) - (sqrt(2)*b*sqrt(2 + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(d*sqrt(f)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2)) + (a*sqrt(2 + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(sqrt(2)*sqrt(f)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2))]
    @test_int [(a + b*x^2)*sqrt(2 + d*x^2)/sqrt(3 + f*x^2), x, 5, -(((6*b*d - 2*b*f - 3*a*d*f)*x*sqrt(2 + d*x^2))/(3*d*f*sqrt(3 + f*x^2))) + (b*x*sqrt(2 + d*x^2)*sqrt(3 + f*x^2))/(3*f) + (sqrt(2)*(6*b*d - 2*b*f - 3*a*d*f)*sqrt(2 + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(3*d*f^(3/2)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2)) - (sqrt(2)*(b - a*f)*sqrt(2 + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(f^(3/2)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2))]
    @test_int [(a + b*x^2)*sqrt(2 + d*x^2)*sqrt(3 + f*x^2), x, 6, ((5*a*d*f*(3*d + 2*f) - 2*b*(9*d^2 - 6*d*f + 4*f^2))*x*sqrt(2 + d*x^2))/(15*d^2*f*sqrt(3 + f*x^2)) + ((3*b*d - 4*b*f + 5*a*d*f)*x*sqrt(2 + d*x^2)*sqrt(3 + f*x^2))/(15*d*f) + (b*x*(2 + d*x^2)^(3/2)*sqrt(3 + f*x^2))/(5*d) - (sqrt(2)*(5*a*d*f*(3*d + 2*f) - 2*b*(9*d^2 - 6*d*f + 4*f^2))*sqrt(2 + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(15*d^2*f^(3/2)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2)) - (sqrt(2)*(3*b*d + 2*b*f - 10*a*d*f)*sqrt(2 + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(5*d*f^(3/2)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2))]

    @test_int [(-b - sqrt(b^2 - 4*a*c) + 2*c*x^2)/(sqrt(1 + (2*c*x^2)/(-b - sqrt(b^2 - 4*a*c)))*sqrt(1 + (2*c*x^2)/(-b + sqrt(b^2 - 4*a*c)))), x, 2, -((sqrt(b - sqrt(b^2 - 4*a*c))*(b + sqrt(b^2 - 4*a*c))*Elliptic.E(asin((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))), (b - sqrt(b^2 - 4*a*c))/(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*sqrt(c)))]
    @test_int [(b - sqrt(b^2 - 4*a*c) + 2*c*x^2)/(sqrt(1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))*sqrt(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))), x, 5, ((b - sqrt(b^2 - 4*a*c))*x*sqrt(1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c))))/sqrt(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c))) - ((b - sqrt(b^2 - 4*a*c))*sqrt(b + sqrt(b^2 - 4*a*c))*sqrt(1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))*Elliptic.E(atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))), -((2*sqrt(b^2 - 4*a*c))/(b - sqrt(b^2 - 4*a*c)))))/(sqrt(2)*sqrt(c)*sqrt((1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))/(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c))))*sqrt(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))) + ((b - sqrt(b^2 - 4*a*c))*sqrt(b + sqrt(b^2 - 4*a*c))*sqrt(1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))*Elliptic.F(atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))), -((2*sqrt(b^2 - 4*a*c))/(b - sqrt(b^2 - 4*a*c)))))/(sqrt(2)*sqrt(c)*sqrt((1 + (2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))/(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c))))*sqrt(1 + (2*c*x^2)/(b + sqrt(b^2 - 4*a*c))))]

    #= ::Section:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^q*(e+f*x^2)^2=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^q / (e+f*x^2)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^(q/2) / (e+f*x^2)=#

    #= ::Subsubsection::Closed:: =#
    #=q>0=#

    @test_int [(a + b*x^2)*sqrt(c + d*x^2)/(e + f*x^2), x, 6, (b*x*sqrt(c + d*x^2))/(2*f) - ((2*b*d*e - b*c*f - 2*a*d*f)*atanh((sqrt(d)*x)/sqrt(c + d*x^2)))/(2*sqrt(d)*f^2) + ((b*e - a*f)*sqrt(d*e - c*f)*atanh((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))))/(sqrt(e)*f^2)]

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    @test_int [(a + b*x^2)^3/((c + d*x^2)*sqrt(e + f*x^2)), x, 14, -((b^2*(b*c - a*d)*x*sqrt(e + f*x^2))/(2*d^2*f)) - (3*b^2*(b*e - 2*a*f)*x*sqrt(e + f*x^2))/(8*d*f^2) + (b^2*x*(a + b*x^2)*sqrt(e + f*x^2))/(4*d*f) - ((b*c - a*d)^3*atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))))/(sqrt(c)*d^3*sqrt(d*e - c*f)) + (b*(b*c - a*d)^2*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(d^3*sqrt(f)) + (b*(b*c - a*d)*(b*e - 2*a*f)*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(2*d^2*f^(3/2)) + (b*(3*b^2*e^2 - 8*a*b*e*f + 8*a^2*f^2)*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(8*d*f^(5/2))]
    @test_int [(a + b*x^2)^2/((c + d*x^2)*sqrt(e + f*x^2)), x, 9, (b^2*x*sqrt(e + f*x^2))/(2*d*f) + ((b*c - a*d)^2*atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))))/(sqrt(c)*d^2*sqrt(d*e - c*f)) - (b*(b*c - a*d)*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(d^2*sqrt(f)) - (b*(b*e - 2*a*f)*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(2*d*f^(3/2))]
    @test_int [(a + b*x^2)^1/((c + d*x^2)*sqrt(e + f*x^2)), x, 5, -(((b*c - a*d)*atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))))/(sqrt(c)*d*sqrt(d*e - c*f))) + (b*atanh((sqrt(f)*x)/sqrt(e + f*x^2)))/(d*sqrt(f))]
    @test_int [(a + b*x^2)^0/((c + d*x^2)*sqrt(e + f*x^2)), x, 2, atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2)))/(sqrt(c)*sqrt(d*e - c*f))]
    @test_int [1/((a + b*x^2)^1*(c + d*x^2)*sqrt(e + f*x^2)), x, 5, (b*atan((sqrt(b*e - a*f)*x)/(sqrt(a)*sqrt(e + f*x^2))))/(sqrt(a)*(b*c - a*d)*sqrt(b*e - a*f)) - (d*atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))))/(sqrt(c)*(b*c - a*d)*sqrt(d*e - c*f))]
    @test_int [1/((a + b*x^2)^2*(c + d*x^2)*sqrt(e + f*x^2)), x, 7, (b^2*x*sqrt(e + f*x^2))/(2*a*(b*c - a*d)*(b*e - a*f)*(a + b*x^2)) + (b*(b^2*c*e - 3*a*b*d*e - 2*a*b*c*f + 4*a^2*d*f)*atan((sqrt(b*e - a*f)*x)/(sqrt(a)*sqrt(e + f*x^2))))/(2*a^(3/2)*(b*c - a*d)^2*(b*e - a*f)^(3/2)) + (d^2*atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))))/(sqrt(c)*(b*c - a*d)^2*sqrt(d*e - c*f))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2) / (e+f*x^2)=#

    #= ::Subsubsection::Closed:: =#
    #=q>0=#

    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)*(c + d*x^2)^(5/2), x, 14, (d*(7*c*e - (2*d*e^2)/f + (3*c^2*f)/d)*x*sqrt(c + d*x^2))/(15*b*sqrt(e + f*x^2)) + ((b*c - a*d)*(b*d*e + 4*b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^3*sqrt(e + f*x^2)) + (d*(b*c - a*d)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b^2) - (2*d*(d*e - 3*c*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*b*f) + (d^2*x*sqrt(c + d*x^2)*(e + f*x^2)^(3/2))/(5*b*f) - (sqrt(e)*(15*a^2*d^2*f^2 - 5*a*b*d*f*(d*e + 7*c*f) + b^2*(-2*d^2*e^2 + 12*c*d*e*f + 23*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^3*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*e^(3/2)*(-40*a*b*c*d*f + 15*a^2*d^2*f + b^2*c*((-d)*e + 34*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^3*c*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^3*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b^3*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)), (d*(7*c*e - (2*d*e^2)/f + (3*c^2*f)/d)*x*sqrt(c + d*x^2))/(15*b*sqrt(e + f*x^2)) + ((b*c - a*d)*(b*d*e + 4*b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^3*sqrt(e + f*x^2)) + (d*(b*c - a*d)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b^2) - (2*d*(d*e - 3*c*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*b*f) + (d^2*x*sqrt(c + d*x^2)*(e + f*x^2)^(3/2))/(5*b*f) - ((b*c - a*d)*sqrt(e)*(b*d*e + 4*b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^3*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(e)*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*(5*b*c - 3*a*d)*(b*c - a*d)*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^3*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d*e^(3/2)*(d*e - 9*c*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^3*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b^3*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)*(c + d*x^2)^(3/2), x, 7, ((b*d*e + 4*b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^2*sqrt(e + f*x^2)) + (d*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b) - (sqrt(e)*(b*d*e + 4*b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*(5*b*c - 3*a*d)*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^2*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^2*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b^2*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)*(c + d*x^2)^(1/2), x, 6, (f*x*sqrt(c + d*x^2))/(b*sqrt(e + f*x^2)) - (sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)/(c + d*x^2)^(1/2), x, 1, (e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)/(c + d*x^2)^(3/2), x, 3, -((sqrt(d)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*(b*c - a*d)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))) + (b*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)/(c + d*x^2)^(5/2), x, 6, -((d*x*sqrt(e + f*x^2))/(3*c*(b*c - a*d)*(c + d*x^2)^(3/2))) - (sqrt(d)*(b*c*(5*d*e - 4*c*f) - a*d*(2*d*e - c*f))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(3*c^(3/2)*(b*c - a*d)^2*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + (d*e^(3/2)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(b*c - a*d)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^2*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(1/2)/(a + b*x^2)/(c + d*x^2)^(7/2), x, 9, -((d*x*sqrt(e + f*x^2))/(5*c*(b*c - a*d)*(c + d*x^2)^(5/2))) - (d*(b*c*(9*d*e - 8*c*f) - a*d*(4*d*e - 3*c*f))*x*sqrt(e + f*x^2))/(15*c^2*(b*c - a*d)^2*(d*e - c*f)*(c + d*x^2)^(3/2)) - (b^2*sqrt(d)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*(b*c - a*d)^3*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + (sqrt(d)*(a*d*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2) - 2*b*c*(9*d^2*e^2 - 14*c*d*e*f + 4*c^2*f^2))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(15*c^(5/2)*(b*c - a*d)^2*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + (d*e^(3/2)*sqrt(f)*(b*c*(9*d*e - 11*c*f) - 2*a*d*(2*d*e - 3*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c^3*(b*c - a*d)^2*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^3*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)^3*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    #= [(e + f*x^2)^(3/2)/(a + b*x^2)*(c + d*x^2)^(5/2), x, 22, ((b*c - a*d)^2*f*(4*b*d*e + b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^4*d*sqrt(e + f*x^2)) + ((b*c - a*d)*(3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2)*x*sqrt(c + d*x^2))/(15*b^2*d*sqrt(e + f*x^2)) - (2*(d*e + c*f)*(d^2*e^2 - 6*c*d*e*f + c^2*f^2)*x*sqrt(c + d*x^2))/(35*b*d*f*sqrt(e + f*x^2)) + ((b*c - a*d)^2*f*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b^3) + (2*(b*c - a*d)*(3*d*e - c*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*b^2) + (d*(9*c*e + (d*e^2)/f - (2*c^2*f)/d)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(35*b) + ((b*c - a*d)*f*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*b^2) + (2*(4*d*e - c*f)*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(35*b) + (f*x*(c + d*x^2)^(5/2)*sqrt(e + f*x^2))/(7*b) - ((b*c - a*d)^2*sqrt(e)*sqrt(f)*(4*b*d*e + b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^4*d*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - ((b*c - a*d)*sqrt(e)*(3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^2*d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (2*sqrt(e)*(d*e + c*f)*(d^2*e^2 - 6*c*d*e*f + c^2*f^2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(35*b*d*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^2*sqrt(e)*sqrt(f)*(5*b*e - 3*a*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^4*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)*e^(3/2)*(9*d*e - c*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (e^(3/2)*(d^2*e^2 - 18*c*d*e*f + c^2*f^2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(35*b*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*c - a*d)^2*(b*e - a*f)^2*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*b^4*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))] =#
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)*(c + d*x^2)^(3/2), x, 14, ((b*c - a*d)^2*f^2*x*sqrt(c + d*x^2))/(b^3*d*sqrt(e + f*x^2)) + (2*(b*c - a*d)*f*(2*d*e - c*f)*x*sqrt(c + d*x^2))/(3*b^2*d*sqrt(e + f*x^2)) + ((3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2)*x*sqrt(c + d*x^2))/(15*b*d*sqrt(e + f*x^2)) + ((b*c - a*d)*f*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b^2) + (2*(3*d*e - c*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*b) + (f*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*b) - (sqrt(e)*(15*a^2*d^2*f^2 - 20*a*b*d*f*(d*e + c*f) + 3*b^2*(d^2*e^2 + 9*c*d*e*f + c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^3*d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(15*a^2*d^2*f + 3*b^2*c*(8*d*e + 3*c*f) - 5*a*b*d*(3*d*e + 5*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b^3*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^2*e^(3/2)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b^3*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)), ((b*c - a*d)*f*(4*b*d*e + b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^3*d*sqrt(e + f*x^2)) + ((3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2)*x*sqrt(c + d*x^2))/(15*b*d*sqrt(e + f*x^2)) + ((b*c - a*d)*f*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b^2) + (2*(3*d*e - c*f)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(15*b) + (f*x*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))/(5*b) - ((b*c - a*d)*sqrt(e)*sqrt(f)*(4*b*d*e + b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^3*d*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(3*d^2*e^2 + 7*c*d*e*f - 2*c^2*f^2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b*d*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)*sqrt(e)*sqrt(f)*(5*b*e - 3*a*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(9*d*e - c*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*b*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*c - a*d)*(b*e - a*f)^2*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*b^3*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)*(c + d*x^2)^(1/2), x, 7, (f*(4*b*d*e + b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b^2*d*sqrt(e + f*x^2)) + (f*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b) - (sqrt(e)*sqrt(f)*(4*b*d*e + b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^2*d*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(e)*sqrt(f)*(5*b*e - 3*a*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*e - a*f)^2*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*b^2*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)/(c + d*x^2)^(1/2), x, 6, (f^2*x*sqrt(c + d*x^2))/(b*d*sqrt(e + f*x^2)) - (sqrt(e)*f^(3/2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*d*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*c*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (e^(3/2)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b*c*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)/(c + d*x^2)^(3/2), x, 3, -(((d*e - c*f)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*sqrt(d)*(b*c - a*d)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))) + (e^(3/2)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)/(c + d*x^2)^(5/2), x, 6, -(((d*e - c*f)*x*sqrt(e + f*x^2))/(3*c*(b*c - a*d)*(c + d*x^2)^(3/2))) - ((b*c*(5*d*e - c*f) - 2*a*d*(d*e + c*f))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(3*c^(3/2)*sqrt(d)*(b*c - a*d)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + (e^(3/2)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(b*c - a*d)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b*e^(3/2)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [(e + f*x^2)^(3/2)/(a + b*x^2)/(c + d*x^2)^(7/2), x, 9, -(((d*e - c*f)*x*sqrt(e + f*x^2))/(5*c*(b*c - a*d)*(c + d*x^2)^(5/2))) - ((3*b*c*(3*d*e - c*f) - 2*a*d*(2*d*e + c*f))*x*sqrt(e + f*x^2))/(15*c^2*(b*c - a*d)^2*(c + d*x^2)^(3/2)) - (b*sqrt(d)*(b*e - a*f)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*(b*c - a*d)^3*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + ((a*d*(8*d^2*e^2 - 3*c*d*e*f - 2*c^2*f^2) - 3*b*c*(6*d^2*e^2 - 6*c*d*e*f + c^2*f^2))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(15*c^(5/2)*sqrt(d)*(b*c - a*d)^2*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) + (e^(3/2)*sqrt(f)*(3*b*c*(3*d*e - 2*c*f) - a*d*(4*d*e - c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(15*c^3*(b*c - a*d)^2*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^2*e^(3/2)*(b*e - a*f)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)^3*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))*(c + d*x^2)^(5/2), x, 12, (d*(b*c - a*d)*x*sqrt(c + d*x^2))/(b^2*sqrt(e + f*x^2)) - (2*d*(d*e - 2*c*f)*x*sqrt(c + d*x^2))/(3*b*f*sqrt(e + f*x^2)) + (d^2*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*b*f) - (d*(b*c - a*d)*sqrt(e)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (2*d*sqrt(e)*(d*e - 2*c*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*(b*c - a*d)*sqrt(e)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b^2*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d*sqrt(e)*(d*e - 3*c*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b*f^(3/2)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*c - a*d)^2*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*b^2*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))*(c + d*x^2)^(3/2), x, 6, (d*x*sqrt(c + d*x^2))/(b*sqrt(e + f*x^2)) - (d*sqrt(e)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*sqrt(e)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(b*sqrt(f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*c - a*d)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*b*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))*(c + d*x^2)^(1/2), x, 1, (c^(3/2)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*sqrt(d)*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))/(c + d*x^2)^(1/2), x, 3, (sqrt(-c)*sqrt(1 + (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi((b*c)/(a*d), asin((sqrt(d)*x)/sqrt(-c)), (c*f)/(d*e)))/(a*sqrt(d)*sqrt(c + d*x^2)*sqrt(e + f*x^2))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))/(c + d*x^2)^(3/2), x, 5, -((d^(3/2)*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(sqrt(c)*(b*c - a*d)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))) - (d*sqrt(e)*(b*d*e - 2*b*c*f + a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*(b*c - a*d)^2*sqrt(f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^2*c^(3/2)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*sqrt(d)*(b*c - a*d)^2*e*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(1/2))/(c + d*x^2)^(5/2), x, 8, -((d^2*x*sqrt(e + f*x^2))/(3*c*(b*c - a*d)*(d*e - c*f)*(c + d*x^2)^(3/2))) - (d^(3/2)*(b*c*(5*d*e - 7*c*f) - 2*a*d*(d*e - 2*c*f))*sqrt(e + f*x^2)*Elliptic.E(atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(3*c^(3/2)*(b*c - a*d)^2*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))) - (d*sqrt(e)*sqrt(f)*(a*d*(d*e - 3*c*f) - 2*b*c*(2*d*e - 3*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(b*c - a*d)^2*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^2*sqrt(-c)*sqrt(1 + (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi((b*c)/(a*d), asin((sqrt(d)*x)/sqrt(-c)), (c*f)/(d*e)))/(a*sqrt(d)*(b*c - a*d)^2*sqrt(c + d*x^2)*sqrt(e + f*x^2))]

    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))*(c + d*x^2)^(5/2), x, 14, ((b*c - a*d)*(b*d*e + 4*b*c*f - 3*a*d*f)*x*sqrt(c + d*x^2))/(3*b*(b*e - a*f)^2*sqrt(e + f*x^2)) + ((b*e*(6*d^2*e^2 - 7*c*d*e*f - c^2*f^2) - a*f*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2))*x*sqrt(c + d*x^2))/(3*e*f*(b*e - a*f)^2*sqrt(e + f*x^2)) + ((d*e - c*f)*x*(c + d*x^2)^(3/2))/(e*(b*e - a*f)*sqrt(e + f*x^2)) + (d*(b*c - a*d)*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*(b*e - a*f)^2) + (d*(a*f*(4*d*e - 3*c*f) - b*e*(3*d*e - 2*c*f))*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(3*e*f*(b*e - a*f)^2) - ((b*c - a*d)*sqrt(e)*(b*d*e + 4*b*c*f - 3*a*d*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b*sqrt(f)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - ((b*e*(6*d^2*e^2 - 7*c*d*e*f - c^2*f^2) - a*f*(8*d^2*e^2 - 13*c*d*e*f + 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*sqrt(e)*f^(3/2)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*(5*b*c - 3*a*d)*(b*c - a*d)*e^(3/2)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*b*c*sqrt(f)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*(2*a*d*f*(2*d*e - 3*c*f) - b*(3*d^2*e^2 - 2*c*d*e*f - 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*f^(3/2)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + ((b*c - a*d)^3*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*b*c*sqrt(f)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))*(c + d*x^2)^(3/2), x, 3, ((d*e - c*f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(sqrt(e)*sqrt(f)*(b*e - a*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (c^(3/2)*(b*c - a*d)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*sqrt(d)*e*(b*e - a*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))*(c + d*x^2)^(1/2), x, 3, -((sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(sqrt(e)*(b*e - a*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))) + (b*c^(3/2)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*sqrt(d)*e*(b*e - a*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))/(c + d*x^2)^(1/2), x, 5, (f^(3/2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(sqrt(e)*(b*e - a*f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (sqrt(e)*sqrt(f)*(2*b*d*e - b*c*f - a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*(b*e - a*f)^2*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^2*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*sqrt(f)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))/(c + d*x^2)^(3/2), x, 8, -((d^2*x)/(c*(b*c - a*d)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt(e + f*x^2))) - (b^2*sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/((b*c - a*d)^2*sqrt(e)*(b*e - a*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d*sqrt(f)*(2*b*c^2*f - a*d*(d*e + c*f))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*(b*c - a*d)^2*sqrt(e)*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d^2*sqrt(e)*(b*d*e - 3*b*c*f + 2*a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*(b*c - a*d)^2*sqrt(f)*(d*e - c*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^3*c^(3/2)*sqrt(e + f*x^2)*Elliptic.Pi(1 - (b*c)/(a*d), atan((sqrt(d)*x)/sqrt(c)), 1 - (c*f)/(d*e)))/(a*sqrt(d)*(b*c - a*d)^2*e*(b*e - a*f)*sqrt(c + d*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2))))]
    @test_int [1/((a + b*x^2)*(e + f*x^2)^(3/2))/(c + d*x^2)^(5/2), x, 11, -((d^2*x)/(3*c*(b*c - a*d)*(d*e - c*f)*(c + d*x^2)^(3/2)*sqrt(e + f*x^2))) - (d^2*(b*c*(5*d*e - 9*c*f) - 2*a*d*(d*e - 3*c*f))*x)/(3*c^2*(b*c - a*d)^2*(d*e - c*f)^2*sqrt(c + d*x^2)*sqrt(e + f*x^2)) + (b^2*f^(3/2)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/((b*c - a*d)^2*sqrt(e)*(b*e - a*f)*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d*sqrt(f)*(b*c*(5*d^2*e^2 - 7*c*d*e*f - 6*c^2*f^2) - a*d*(2*d^2*e^2 - 7*c*d*e*f - 3*c^2*f^2))*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(b*c - a*d)^2*sqrt(e)*(d*e - c*f)^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (b^2*sqrt(e)*sqrt(f)*(2*b*d*e - b*c*f - a*d*f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(c*(b*c - a*d)^2*(b*e - a*f)^2*(d*e - c*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d^2*sqrt(e)*sqrt(f)*(b*c*(7*d*e - 15*c*f) - a*d*(d*e - 9*c*f))*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(3*c^2*(b*c - a*d)^2*(d*e - c*f)^3*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (b^4*e^(3/2)*sqrt(c + d*x^2)*Elliptic.Pi(1 - (b*e)/(a*f), atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(a*c*(b*c - a*d)^2*sqrt(f)*(b*e - a*f)^2*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2))]

    @test_int [(1 + x^2)^(3/2)*sqrt(2 + x^2)/(a + b*x^2), x, 7, -(((a - 2*b)*x*sqrt(2 + x^2))/(b^2*sqrt(1 + x^2))) + (x*sqrt(1 + x^2)*sqrt(2 + x^2))/(3*b) + (sqrt(2)*(a - 2*b)*sqrt(2 + x^2)*Elliptic.E(atan(x), 1/2))/(b^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) - ((3*a - 7*b)*sqrt(2 + x^2)*Elliptic.F(atan(x), 1/2))/(3*sqrt(2)*b^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) + ((a - 2*b)*(a - b)*sqrt(2 + x^2)*Elliptic.Pi(1 - b/a, atan(x), 1/2))/(sqrt(2)*a*b^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))), -(((a - 2*b)*x*sqrt(2 + x^2))/(b^2*sqrt(1 + x^2))) + (x*sqrt(1 + x^2)*sqrt(2 + x^2))/(3*b) + (sqrt(2)*(a - 2*b)*sqrt(2 + x^2)*Elliptic.E(atan(x), 1/2))/(b^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) - (sqrt(2)*(3*a - 5*b)*sqrt(2 + x^2)*Elliptic.F(atan(x), 1/2))/(3*b^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) + (2*(a - b)^2*sqrt(1 + x^2)*Elliptic.Pi(1 - (2*b)/a, atan(x/sqrt(2)), -1))/(a*b^2*sqrt((1 + x^2)/(2 + x^2))*sqrt(2 + x^2))]
    @test_int [(1 + x^2)^(1/2)*sqrt(2 + x^2)/(a + b*x^2), x, 6, (x*sqrt(2 + x^2))/(b*sqrt(1 + x^2)) - (sqrt(2)*sqrt(2 + x^2)*Elliptic.E(atan(x), 1/2))/(b*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) + (sqrt(2 + x^2)*Elliptic.F(atan(x), 1/2))/(sqrt(2)*b*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) - ((a - 2*b)*sqrt(2 + x^2)*Elliptic.Pi(1 - b/a, atan(x), 1/2))/(sqrt(2)*a*b*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2)))]
    @test_int [sqrt(2 + x^2)/((1 + x^2)^(1/2)*(a + b*x^2)), x, 1, (2*sqrt(1 + x^2)*Elliptic.Pi(1 - (2*b)/a, atan(x/sqrt(2)), -1))/(a*sqrt((1 + x^2)/(2 + x^2))*sqrt(2 + x^2))]
    @test_int [sqrt(2 + x^2)/((1 + x^2)^(3/2)*(a + b*x^2)), x, 3, (sqrt(2)*sqrt(2 + x^2)*Elliptic.E(atan(x), 1/2))/((a - b)*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) - (2*b*sqrt(1 + x^2)*Elliptic.Pi(1 - (2*b)/a, atan(x/sqrt(2)), -1))/(a*(a - b)*sqrt((1 + x^2)/(2 + x^2))*sqrt(2 + x^2))]
    @test_int [sqrt(2 + x^2)/((1 + x^2)^(5/2)*(a + b*x^2)), x, 6, (x*sqrt(2 + x^2))/(3*(a - b)*(1 + x^2)^(3/2)) + (sqrt(2)*(a - 2*b)*sqrt(2 + x^2)*Elliptic.E(atan(x), 1/2))/((a - b)^2*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) - (sqrt(2)*sqrt(2 + x^2)*Elliptic.F(atan(x), 1/2))/(3*(a - b)*sqrt(1 + x^2)*sqrt((2 + x^2)/(1 + x^2))) + (2*b^2*sqrt(1 + x^2)*Elliptic.Pi(1 - (2*b)/a, atan(x/sqrt(2)), -1))/(a*(a - b)^2*sqrt((1 + x^2)/(2 + x^2))*sqrt(2 + x^2))]

    @test_int [sqrt(2 + d*x^2)*sqrt(3 + f*x^2)/(a + b*x^2), x, 6, (f*x*sqrt(2 + d*x^2))/(b*sqrt(3 + f*x^2)) - (sqrt(2)*sqrt(f)*sqrt(2 + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(b*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2)) + (3*d*sqrt(2 + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(sqrt(2)*b*sqrt(f)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2)) + (3*(2*b - a*d)*sqrt(2 + d*x^2)*Elliptic.Pi(1 - (3*b)/(a*f), atan((sqrt(f)*x)/sqrt(3)), 1 - (3*d)/(2*f)))/(sqrt(2)*a*b*sqrt(f)*sqrt((2 + d*x^2)/(3 + f*x^2))*sqrt(3 + f*x^2))]
    @test_int [sqrt(2 + d*x^2)/((a + b*x^2)*sqrt(3 + f*x^2)), x, 1, (2*sqrt(3 + f*x^2)*Elliptic.Pi(1 - (2*b)/(a*d), atan((sqrt(d)*x)/sqrt(2)), 1 - (2*f)/(3*d)))/(sqrt(3)*a*sqrt(d)*sqrt(2 + d*x^2)*sqrt((3 + f*x^2)/(2 + d*x^2)))]
    @test_int [1/((a + b*x^2)*sqrt(2 + d*x^2)*sqrt(3 + f*x^2)), x, 1, Elliptic.Pi((2*b)/(a*d), asin((sqrt(-d)*x)/sqrt(2)), (2*f)/(3*d))/(sqrt(3)*a*sqrt(-d))]

    @test_int [sqrt(1 - x^2)/((x^2 - 1)*sqrt(a + b*x^2)), x, 3, -((sqrt(1 + (b*x^2)/a)*Elliptic.F(asin(x), -(b/a)))/sqrt(a + b*x^2))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^q / (e+f*x^2)^2=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^p*(c+d*x^2)^(q/2) / (e+f*x^2)^2=#

    #= ::Subsubsection:: =#
    #=q>0=#

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    @test_int [(a + b*x^2)/(sqrt(c + d*x^2)*(e + f*x^2)^2), x, 4, ((b*e - a*f)*x*sqrt(c + d*x^2))/(2*e*(d*e - c*f)*(e + f*x^2)) - ((b*c*e - 2*a*d*e + a*c*f)*atanh((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))))/(2*e^(3/2)*(d*e - c*f)^(3/2))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2) / (e+f*x^2)^2=#

    #= ::Subsubsection::Closed:: =#
    #=q>0=#

    @test_int [sqrt(c - d*x^2)*sqrt(e + f*x^2)/(a + b*x^2)^2, x, 11, (x*sqrt(c - d*x^2)*sqrt(e + f*x^2))/(2*a*(a + b*x^2)) + (sqrt(c)*sqrt(d)*sqrt(1 - (d*x^2)/c)*sqrt(e + f*x^2)*Elliptic.E(asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a*b*sqrt(c - d*x^2)*sqrt(1 + (f*x^2)/e)) - (sqrt(c)*sqrt(d)*(b*e + a*f)*sqrt(1 - (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.F(asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a*b^2*sqrt(c - d*x^2)*sqrt(e + f*x^2)) + (sqrt(c)*(b^2*c*e + a^2*d*f)*sqrt(1 - (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi(-((b*c)/(a*d)), asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a^2*b^2*sqrt(d)*sqrt(c - d*x^2)*sqrt(e + f*x^2))]
    @test_int [sqrt(c + d*x^2)*sqrt(e + f*x^2)/(a + b*x^2)^2, x, 8, -((f*x*sqrt(c + d*x^2))/(2*a*b*sqrt(e + f*x^2))) + (x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(2*a*(a + b*x^2)) + (sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(2*a*b*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (d*sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(2*b^2*c*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(-c)*(b^2*c*e - a^2*d*f)*sqrt(1 + (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi((b*c)/(a*d), asin((sqrt(d)*x)/sqrt(-c)), (c*f)/(d*e)))/(2*a^2*b^2*sqrt(d)*sqrt(c + d*x^2)*sqrt(e + f*x^2))]

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    @test_int [1/(sqrt(c - d*x^2)*sqrt(e + f*x^2)*(a + b*x^2)^2), x, 11, (b^2*x*sqrt(c - d*x^2)*sqrt(e + f*x^2))/(2*a*(b*c + a*d)*(b*e - a*f)*(a + b*x^2)) + (b*sqrt(c)*sqrt(d)*sqrt(1 - (d*x^2)/c)*sqrt(e + f*x^2)*Elliptic.E(asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a*(b*c + a*d)*(b*e - a*f)*sqrt(c - d*x^2)*sqrt(1 + (f*x^2)/e)) - (sqrt(c)*sqrt(d)*sqrt(1 - (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.F(asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a*(b*c + a*d)*sqrt(c - d*x^2)*sqrt(e + f*x^2)) + (sqrt(c)*(b^2*c*e - 3*a^2*d*f + a*b*(2*d*e - 2*c*f))*sqrt(1 - (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi(-((b*c)/(a*d)), asin((sqrt(d)*x)/sqrt(c)), -((c*f)/(d*e))))/(2*a^2*sqrt(d)*(b*c + a*d)*(b*e - a*f)*sqrt(c - d*x^2)*sqrt(e + f*x^2))]
    @test_int [1/(sqrt(c + d*x^2)*sqrt(e + f*x^2)*(a + b*x^2)^2), x, 8, -((b*f*x*sqrt(c + d*x^2))/(2*a*(b*c - a*d)*(b*e - a*f)*sqrt(e + f*x^2))) + (b^2*x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(2*a*(b*c - a*d)*(b*e - a*f)*(a + b*x^2)) + (b*sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.E(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(2*a*(b*c - a*d)*(b*e - a*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) - (d*sqrt(e)*sqrt(f)*sqrt(c + d*x^2)*Elliptic.F(atan((sqrt(f)*x)/sqrt(e)), 1 - (d*e)/(c*f)))/(2*c*(b*c - a*d)*(b*e - a*f)*sqrt((e*(c + d*x^2))/(c*(e + f*x^2)))*sqrt(e + f*x^2)) + (sqrt(-c)*(b^2*c*e + 3*a^2*d*f - 2*a*b*(d*e + c*f))*sqrt(1 + (d*x^2)/c)*sqrt(1 + (f*x^2)/e)*Elliptic.Pi((b*c)/(a*d), asin((sqrt(d)*x)/sqrt(-c)), (c*f)/(d*e)))/(2*a^2*sqrt(d)*(b*c - a*d)*(b*e - a*f)*sqrt(c + d*x^2)*sqrt(e + f*x^2))]

    #= ::Title:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2)*(e+f*x^2)^(r/2)=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2) / (e+f*x^2)^(1/2)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(a+b*x^2)^(p/2)*(c+d*x^2)^(q/2) / (e+f*x^2)^(1/2)=#

    #= ::Subsubsection::Closed:: =#
    #=q>0=#

    #= Not*sure*this*is*not*integrable. =#
    @test_int [(a + b*x^2)^(3/2)*sqrt(c + d*x^2)/sqrt(e + f*x^2), x, 0, Unintegrable(((a + b*x^2)^(3/2)*sqrt(c + d*x^2))/sqrt(e + f*x^2), x)]
    @test_int [(a + b*x^2)^(1/2)*sqrt(c + d*x^2)/sqrt(e + f*x^2), x, 7, (d*x*sqrt(a + b*x^2)*sqrt(e + f*x^2))/(2*f*sqrt(c + d*x^2)) - (sqrt(e)*sqrt(d*e - c*f)*sqrt(a + b*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))*Elliptic.E(asin((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(2*f*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(e + f*x^2)) + (b*sqrt(e)*(d*e - c*f)*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.F(asin((sqrt(b*e - a*f)*x)/(sqrt(e)*sqrt(a + b*x^2))), ((b*c - a*d)*e)/(c*(b*e - a*f))))/(2*d*f*sqrt(b*e - a*f)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2)) - (c*sqrt(e)*(b*d*e - b*c*f - a*d*f)*sqrt(a + b*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))*Elliptic.Pi((d*e)/(d*e - c*f), asin((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(2*a*d*f*sqrt(d*e - c*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(e + f*x^2))]
    @test_int [sqrt(c + d*x^2)/((a + b*x^2)^(1/2)*sqrt(e + f*x^2)), x, 2, (c*sqrt(e)*sqrt(a + b*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))*Elliptic.Pi((d*e)/(d*e - c*f), asin((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(a*sqrt(d*e - c*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(e + f*x^2))]
    @test_int [sqrt(c + d*x^2)/((a + b*x^2)^(3/2)*sqrt(e + f*x^2)), x, 2, (sqrt(e)*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.E(asin((sqrt(b*e - a*f)*x)/(sqrt(e)*sqrt(a + b*x^2))), ((b*c - a*d)*e)/(c*(b*e - a*f))))/(a*sqrt(b*e - a*f)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2))]

    #= Not*sure*this*is*not*integrable. =#
    @test_int [(a + b*x^2)^(3/2)*sqrt(c + d*x^2)/(e + f*x^2)^(3/2), x, 0, Unintegrable(((a + b*x^2)^(3/2)*sqrt(c + d*x^2))/(e + f*x^2)^(3/2), x)]
    @test_int [(a + b*x^2)^(1/2)*sqrt(c + d*x^2)/(e + f*x^2)^(3/2), x, 8, -(((d*e - c*f)*x*sqrt(a + b*x^2))/(e*f*sqrt(c + d*x^2)*sqrt(e + f*x^2))) + (sqrt(c)*sqrt(d*e - c*f)*sqrt(a + b*x^2)*Elliptic.E(atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(e*f*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2)) - (c^(3/2)*(b*e - a*f)*sqrt(a + b*x^2)*Elliptic.F(atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(a*e*f*sqrt(d*e - c*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2)) + (b*c*sqrt(e)*sqrt(a + b*x^2)*sqrt((c*(e + f*x^2))/(e*(c + d*x^2)))*Elliptic.Pi((d*e)/(d*e - c*f), asin((sqrt(d*e - c*f)*x)/(sqrt(e)*sqrt(c + d*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(a*f*sqrt(d*e - c*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(e + f*x^2))]
    @test_int [sqrt(c + d*x^2)/((a + b*x^2)^(1/2)*(e + f*x^2)^(3/2)), x, 5, ((d*e - c*f)*x*sqrt(a + b*x^2))/(e*(b*e - a*f)*sqrt(c + d*x^2)*sqrt(e + f*x^2)) - (sqrt(c)*sqrt(d*e - c*f)*sqrt(a + b*x^2)*Elliptic.E(atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(e*(b*e - a*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2)) + (c^(3/2)*sqrt(a + b*x^2)*Elliptic.F(atan((sqrt(d*e - c*f)*x)/(sqrt(c)*sqrt(e + f*x^2))), -(((b*c - a*d)*e)/(a*(d*e - c*f)))))/(a*e*sqrt(d*e - c*f)*sqrt((c*(a + b*x^2))/(a*(c + d*x^2)))*sqrt(c + d*x^2))]
    @test_int [sqrt(c + d*x^2)/((a + b*x^2)^(3/2)*(e + f*x^2)^(3/2)), x, 0, Unintegrable(sqrt(c + d*x^2)/((a + b*x^2)^(3/2)*(e + f*x^2)^(3/2)), x)]

    @test_int [sqrt(c + d*x^2)*sqrt(e + f*x^2)/sqrt(a + b*x^2), x, 7, (x*sqrt(c + d*x^2)*sqrt(e + f*x^2))/(2*sqrt(a + b*x^2)) - (sqrt(c)*sqrt(b*c - a*d)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2)*Elliptic.E(asin((sqrt(b*c - a*d)*x)/(sqrt(c)*sqrt(a + b*x^2))), (c*(b*e - a*f))/((b*c - a*d)*e)))/(2*b*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))) + ((b*c - a*d)*sqrt(e)*(2*b*e - a*f)*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.F(asin((sqrt(b*e - a*f)*x)/(sqrt(e)*sqrt(a + b*x^2))), ((b*c - a*d)*e)/(c*(b*e - a*f))))/(2*b^2*c*sqrt(b*e - a*f)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2)) - (a*(a*d*f - b*(d*e + c*f))*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.Pi((b*c)/(b*c - a*d), asin((sqrt(b*c - a*d)*x)/(sqrt(c)*sqrt(a + b*x^2))), (c*(b*e - a*f))/((b*c - a*d)*e)))/(2*b^2*sqrt(c)*sqrt(b*c - a*d)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2))]

    #= ::Subsubsection::Closed:: =#
    #=q<0=#

    #= Not*sure*this*is*not*integrable. =#
    @test_int [(a + b*x^2)^(3/2)/(sqrt(c + d*x^2)*sqrt(e + f*x^2)), x, 0, Unintegrable((a + b*x^2)^(3/2)/(sqrt(c + d*x^2)*sqrt(e + f*x^2)), x)]
    @test_int [(a + b*x^2)^(1/2)/(sqrt(c + d*x^2)*sqrt(e + f*x^2)), x, 2, (a*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.Pi((b*c)/(b*c - a*d), asin((sqrt(b*c - a*d)*x)/(sqrt(c)*sqrt(a + b*x^2))), (c*(b*e - a*f))/((b*c - a*d)*e)))/(sqrt(c)*sqrt(b*c - a*d)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2))]
    @test_int [1/((a + b*x^2)^(1/2)*sqrt(c + d*x^2)*sqrt(e + f*x^2)), x, 2, (sqrt(e)*sqrt(c + d*x^2)*sqrt((a*(e + f*x^2))/(e*(a + b*x^2)))*Elliptic.F(asin((sqrt(b*e - a*f)*x)/(sqrt(e)*sqrt(a + b*x^2))), ((b*c - a*d)*e)/(c*(b*e - a*f))))/(c*sqrt(b*e - a*f)*sqrt((a*(c + d*x^2))/(c*(a + b*x^2)))*sqrt(e + f*x^2))]
    @test_int [1/((a + b*x^2)^(3/2)*sqrt(c + d*x^2)*sqrt(e + f*x^2)), x, 0, Unintegrable(1/((a + b*x^2)^(3/2)*sqrt(c + d*x^2)*sqrt(e + f*x^2)), x)]
    end

max_stars_repo_path: test/1 Algebraic functions/1.1 Binomial products/1.1.2 Quadratic/1.1.2.5 (a+b x^2)^p (c+d x^2)^q (e+f x^2)^r.jl


text:
using JuLIP, ACE, LinearAlgebra

#---

module ParamTest

using ACE, JuLIP, LinearAlgebra
import ACE: alloc_temp
import ACE.PairPotentials: PolyPairBasis
import ACE.OrthPolys: TransformedPolys
import JuLIP: energy, evaluate!

set_params(trans::PolyTransform, params) =
          PolyTransform(params[1], params[2])

set_params(J::TransformedPolys, params) =
          TransformedPolys(J.J,
                           set_params(J.trans, params),
                           J.rl, J.ru)

set_params(pB::PolyPairBasis, params) =
         PolyPairBasis( set_params(pB.J, params),
                        pB.zlist, pB.bidx0 )

function energy(params::AbstractVector{TP}, pB::PolyPairBasis, at::Atoms{T}) where {T, TP}
   E = zeros(TP, length(pB))
   pB_p = set_params(pB, params)
   # return energy(pB_p, at)   #  <---- goal for later ???!!!
   tmp = alloc_temp(pB_p)
   tmpJ = zeros(TP, length(pB_p))     # HACK
   for (i, j, R) in pairs(at, cutoff(pB_p))
      r = norm(R)
      evaluate!(tmpJ, tmp.tmp_J, pB_p.J, r)
      idx0 = ACE.PairPotentials._Bidx0(pB_p, at.Z[i], at.Z[j])
      for n = 1:length(pB_p.J)
         E[idx0 + n] += 0.5 * tmpJ[n]
      end
   end
   return E
end

end

#---

pB = ACE.Utils.pair_basis(; species=:W, trans = PolyTransform(2.0, 2.7))

at = bulk(:W, cubic=true) * 3
B1 = energy(pB, at)

params = [2.1, 2.6]
B2 = energy(params, pB, at)

using ForwardDiff
DB = ForwardDiff.jacobian( p -> energy(p, pB, at), params)

dp = rand(2) .= 0.5
for p = 2:10
   h = 0.1^p
   Bh = energy(params + h * dp, pB, at)
   err = norm((Bh - B2) / h - DB * dp, Inf)
   @show err
end

ext: jl


text:
# Autogenerated wrapper script for CSFML_jll for x86_64-linux-musl-cxx11
export libcsfml_audio, libcsfml_graphics, libcsfml_network, libcsfml_system, libcsfml_window

using SFML_jll
JLLWrappers.@generate_wrapper_header("CSFML")
JLLWrappers.@declare_library_product(libcsfml_audio, "libcsfml-audio.so.2.5")
JLLWrappers.@declare_library_product(libcsfml_graphics, "libcsfml-graphics.so.2.5")
JLLWrappers.@declare_library_product(libcsfml_network, "libcsfml-network.so.2.5")
JLLWrappers.@declare_library_product(libcsfml_system, "libcsfml-system.so.2.5")
JLLWrappers.@declare_library_product(libcsfml_window, "libcsfml-window.so.2.5")
function __init__()
    JLLWrappers.@generate_init_header(SFML_jll)
    JLLWrappers.@init_library_product(
        libcsfml_audio,
        "lib/libcsfml-audio.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@init_library_product(
        libcsfml_graphics,
        "lib/libcsfml-graphics.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@init_library_product(
        libcsfml_network,
        "lib/libcsfml-network.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@init_library_product(
        libcsfml_system,
        "lib/libcsfml-system.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@init_library_product(
        libcsfml_window,
        "lib/libcsfml-window.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@generate_init_footer()
end  # __init__()


text:
using brainflow

# enable logs
brainflow.enable_dev_brainflow_logger(brainflow.BOARD_CONTROLLER)
brainflow.enable_dev_brainflow_logger(brainflow.DATA_HANDLER)

params = BrainFlowInputParams()
board_shim = brainflow.BoardShim(brainflow.SYNTHETIC_BOARD, params)
sampling_rate = brainflow.get_sampling_rate(brainflow.SYNTHETIC_BOARD)

brainflow.prepare_session(board_shim)
brainflow.start_stream(board_shim)
sleep(5)
brainflow.stop_stream(board_shim)
data = brainflow.get_current_board_data(brainflow.get_nearest_power_of_two(sampling_rate), board_shim)
brainflow.release_session(board_shim)

eeg_channels = brainflow.get_eeg_channels(brainflow.SYNTHETIC_BOARD)
data_first_channel = data[eeg_channels[1], :]

# returns tuple of wavelet coeffs and lengths
wavelet_data = brainflow.perform_wavelet_transform(data_first_channel, "db4", 2)
restored_wavelet_data = brainflow.perform_inverse_wavelet_transform(wavelet_data, length(data_first_channel), "db4", 2)

fft_data = brainflow.perform_fft(data_first_channel, brainflow.NO_WINDOW)
restored_fft_data = brainflow.perform_ifft(fft_data)

println("Original Data")
println(data_first_channel)
println("Restored from Wavelet Data")
println(restored_wavelet_data)
println("Restored from FFT Data")
println(restored_fft_data)

max_stars_repo_name: matthijscox/brainflow

max_issues_repo_name: matthijscox/brainflow

max_forks_repo_name: matthijscox/brainflow


text:
using .CUDA
CUDA.allowscalar(false)
##############################################################################
##
## Conversion FixedEffect between CPU and GPU
##
##############################################################################

# https://github.com/JuliaGPU/CUDA.jl/issues/142
cuzeros(T::Type, n::Integer) = fill!(CuVector{T}(undef, n), zero(T))
function CUDA.cu(T::Type, fe::FixedEffect)
	refs = CuArray(fe.refs)
	interaction = cu(T, fe.interaction)
	FixedEffect{typeof(refs), typeof(interaction)}(refs, interaction, fe.n)
end
CUDA.cu(T::Type, w::UnitWeights) = fill!(CuVector{T}(undef, length(w)), w[1])
CUDA.cu(T::Type, w::AbstractVector) = CuVector{T}(convert(Vector{T}, w))

##############################################################################
##
## FixedEffectLinearMap on the GPU (code by Paul Schrimpf)
##
## Model matrix of categorical variables
## mutiplied by diag(1/sqrt(∑w * interaction^2, ..., ∑w * interaction^2) (Jacobi preconditoner)
##
## We define these methods used in lsmr! (duck typing):
## eltyp
## size
## mul!
##
##############################################################################

mutable struct FixedEffectLinearMapGPU{T}
	fes::Vector{<:FixedEffect}
	scales::Vector{<:AbstractVector}
	caches::Vector{<:AbstractVector}
	nthreads::Int
end

function FixedEffectLinearMapGPU{T}(fes::Vector{<:FixedEffect}, ::Type{Val{:gpu}}, nthreads) where {T}
	fes = [cu(T, fe) for fe in fes]
	scales = [cuzeros(T, fe.n) for fe in fes]
	caches = [cuzeros(T, length(fes[1].interaction)) for fe in fes]
	return FixedEffectLinearMapGPU{T}(fes, scales, caches, nthreads)
end

LinearAlgebra.adjoint(fem::FixedEffectLinearMapGPU) = Adjoint(fem)

function Base.size(fem::FixedEffectLinearMapGPU, dim::Integer)
	(dim == 1) ? length(fem.fes[1].refs) : (dim == 2) ? sum(fe.n for fe in fem.fes) : 1
end

Base.eltype(x::FixedEffectLinearMapGPU{T}) where {T} = T

function LinearAlgebra.mul!(fecoefs::FixedEffectCoefficients,
	Cfem::Adjoint{T, FixedEffectLinearMapGPU{T}},
	y::AbstractVector, α::Number, β::Number) where {T}
	fem = adjoint(Cfem)
	rmul!(fecoefs, β)
	for (fecoef, fe, cache) in zip(fecoefs.x, fem.fes, fem.caches)
		gather!(fecoef, fe.refs, α, y, cache, fem.nthreads)
	end
	return fecoefs
end

function gather!(fecoef::CuVector, refs::CuVector, α::Number, y::CuVector, cache::CuVector, nthreads::Integer)
	nblocks = cld(length(y), nthreads)
	@cuda threads=nthreads blocks=nblocks gather_kernel!(fecoef, refs, α, y, cache)
end

function gather_kernel!(fecoef, refs, α, y, cache)
	index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
	stride = blockDim().x * gridDim().x
	@inbounds for i = index:stride:length(y)
		CUDA.atomic_add!(pointer(fecoef, refs[i]), α * y[i] * cache[i])
	end
end

function LinearAlgebra.mul!(y::AbstractVector, fem::FixedEffectLinearMapGPU,
			  fecoefs::FixedEffectCoefficients, α::Number, β::Number)
	rmul!(y, β)
	for (fecoef, fe, cache) in zip(fecoefs.x, fem.fes, fem.caches)
		scatter!(y, α, fecoef, fe.refs, cache, fem.nthreads)
	end
	return y
end

function scatter!(y::CuVector, α::Number, fecoef::CuVector, refs::CuVector, cache::CuVector, nthreads::Integer)
	nblocks = cld(length(y), nthreads)
	@cuda threads=nthreads blocks=nblocks scatter_kernel!(y, α, fecoef, refs, cache)
end

function scatter_kernel!(y, α, fecoef, refs, cache)
	index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
	stride = blockDim().x * gridDim().x
	@inbounds for i = index:stride:length(y)
		y[i] += α * fecoef[refs[i]] * cache[i]
	end
end

##############################################################################
##
## Implement AbstractFixedEffectSolver interface
##
##############################################################################

mutable struct FixedEffectSolverGPU{T} <: AbstractFixedEffectSolver{T}
	m::FixedEffectLinearMapGPU{T}
	weights::CuVector{T}
	b::CuVector{T}
	r::CuVector{T}
	x::FixedEffectCoefficients{<: AbstractVector{T}}
	v::FixedEffectCoefficients{<: AbstractVector{T}}
	h::FixedEffectCoefficients{<: AbstractVector{T}}
	hbar::FixedEffectCoefficients{<: AbstractVector{T}}
	tmp::Vector{T} # used to convert AbstractVector to Vector{T}
	fes::Vector{<:FixedEffect}
end

function AbstractFixedEffectSolver{T}(fes::Vector{<:FixedEffect}, weights::AbstractWeights, ::Type{Val{:gpu}}, nthreads = 256) where {T}
	m = FixedEffectLinearMapGPU{T}(fes, Val{:gpu}, nthreads)
	b = cuzeros(T, length(weights))
	r = cuzeros(T, length(weights))
	x = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
	v = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
	h = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
	hbar = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
	tmp = zeros(T, length(weights))
	update_weights!(FixedEffectSolverGPU{T}(m, cuzeros(T, length(weights)), b, r, x, v, h, hbar, tmp, fes), weights)
end

function update_weights!(feM::FixedEffectSolverGPU{T}, weights::AbstractWeights) where {T}
	weights = cu(T, weights)
	nthreads = feM.m.nthreads
	for (scale, fe) in zip(feM.m.scales, feM.m.fes)
		scale!(scale, fe.refs, fe.interaction, weights, nthreads)
	end
	for (cache, scale, fe) in zip(feM.m.caches, feM.m.scales, feM.m.fes)
		cache!(cache, fe.refs, fe.interaction, weights, scale, nthreads)
	end
	feM.weights = weights
	return feM
end

function scale!(scale::CuVector, refs::CuVector, interaction::CuVector, weights::CuVector, nthreads::Integer)
	nblocks = cld(length(refs), nthreads)
        fill!(scale, 0)
	@cuda threads=nthreads blocks=nblocks scale_kernel!(scale, refs, interaction, weights)
	@cuda threads=nthreads blocks=nblocks inv_kernel!(scale)
end

function scale_kernel!(scale, refs, interaction, weights)
	index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
	stride = blockDim().x * gridDim().x
	@inbounds for i = index:stride:length(interaction)
		CUDA.atomic_add!(pointer(scale, refs[i]), abs2(interaction[i]) * weights[i])
	end
end

function inv_kernel!(scale)
	index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
	stride = blockDim().x * gridDim().x
	@inbounds for i = index:stride:length(scale)
		scale[i] = (scale[i] > 0) ? (1 / sqrt(scale[i])) : 0.0
	end
end

function cache!(cache::CuVector, refs::CuVector, interaction::CuVector, weights::CuVector, scale::CuVector, nthreads::Integer)
	nblocks = cld(length(cache), nthreads)
	@cuda threads=nthreads blocks=nblocks cache!_kernel!(cache, refs, interaction, weights, scale)
end

function cache!_kernel!(cache, refs, interaction, weights, scale)
	index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
	stride = blockDim().x * gridDim().x
	@inbounds for i = index:stride:length(cache)
		cache[i] = interaction[i] * sqrt(weights[i]) * scale[refs[i]]
	end
end

function solve_residuals!(r::AbstractVector, feM::FixedEffectSolverGPU{T}; tol::Real = sqrt(eps(T)), maxiter::Integer = 100_000) where {T}
	copyto!(feM.tmp, r)
	copyto!(feM.r, feM.tmp)
	if !(feM.weights isa UnitWeights)
		feM.r .*= sqrt.(feM.weights)
	end
	copyto!(feM.b, feM.r)
	mul!(feM.x, feM.m', feM.b, 1, 0)
	x, ch = lsmr!(feM.x, feM.m, feM.b, feM.v, feM.h, feM.hbar; atol = tol, btol = tol, maxiter = maxiter)
	mul!(feM.r, feM.m, feM.x, -1, 1)
	if !(feM.weights isa UnitWeights)
		feM.r ./=  sqrt.(feM.weights)
	end
	copyto!(feM.tmp, feM.r)
	copyto!(r, feM.tmp)
	return r, ch.mvps + 1, ch.isconverged
end

function FixedEffects.solve_residuals!(X::AbstractMatrix, feM::FixedEffects.FixedEffectSolverGPU; progress_bar = true, kwargs...)
    iterations = Int[]
    convergeds = Bool[]
    for j in 1:size(X, 2)
        _, iteration, converged = solve_residuals!(view(X, :, j), feM; kwargs...)
        push!(iterations, iteration)
        push!(convergeds, converged)
    end
    return X, iterations, convergeds
end

function solve_coefficients!(r::AbstractVector, feM::FixedEffectSolverGPU{T}; tol::Real = sqrt(eps(T)), maxiter::Integer = 100_000) where {T}
	copyto!(feM.tmp, r)
	copyto!(feM.b, feM.tmp)
	if !(feM.weights isa UnitWeights)
		feM.b .*= sqrt.(feM.weights)
	end
	fill!(feM.x, 0.0)
	x, ch = lsmr!(feM.x, feM.m, feM.b, feM.v, feM.h, feM.hbar; atol = tol, btol = tol, maxiter = maxiter)
	for (x, scale) in zip(feM.x.x, feM.m.scales)
		x .*=  scale
	end
	x = Vector{eltype(r)}[collect(x) for x in feM.x.x]
	full(normalize!(x, feM.fes; tol = tol, maxiter = maxiter), feM.fes), div(ch.mvps, 2), ch.isconverged
end


text:
module ThermofluidQuantities

import Base:+,*,-,/,^,>,<,>=,<=,==,isapprox
import Base: exp, exp10, exp2, expm1, log, log10, log1p, log2, sqrt
import Base: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh,
             sinpi, cospi, sinc, cosc, cis

  # This form is necessary to add new units
  import Unitful
  using Unitful: @unit, @u_str, Quantity, @derived_dimension, uconvert
  import Unitful: unit, ustrip
  using Unitful.DefaultSymbols

  export @u_str
  export value, name, unit, ustrip, ushow, uconvert
  export default_unit
  export PhysicalQuantity, DimensionalPhysicalQuantity, DimensionlessPhysicalQuantity
  export AbstractFluid
  export @displayedunits, @dimvar, @nondimvar, @gas, @liquid, displayedunits

  abstract type AbstractFluid end

  const dimvartypes = Vector{Type}()
  const nondimvartypes = Vector{Type}()
  const unittypes = Vector{Symbol}()

  include("units.jl")
  include("utils.jl")
  include("quantities.jl")
  include("basicrelations.jl")
  include("gases.jl")
  include("liquids.jl")
  include("gasdefs.jl")
  include("liquiddefs.jl")
  include("frictionfactor.jl")

  include("plot_recipes.jl")

  const localunits = Unitful.basefactors

  function __init__()

    merge!(Unitful.basefactors, localunits)
    Unitful.register(ThermofluidQuantities)

  end

end # module

max_stars_repo_name: UCLAMAEThreads/ThermofluidQuantities

max_issues_repo_name: UCLAMAEThreads/ThermofluidQuantities

max_forks_repo_name: UCLAMAEThreads/ThermofluidQuantities


text:
test_data_name = "hotel_test.pkl";                                                  # test data set name
test_scene_id = 0;                                                                  # test data id
start_time_idx = 401;                                                               # start time index in test data
ego_pos_init_vec = [-1.5, -8.5] .+ [-1.393743, 2.978962];                           # initial ego position [x, y] [m]
ego_pos_goal_vec = [3.5, 0.0]   .+ [-1.393743, 2.978962];                           # goal ego position [x, y] [m]
target_speed = 1.0;                                                                 # target speed [m/s]
sim_horizon = 10.0;                                                                 # simulation time horizon [s]


text:
"""
Methods for the reconstruction engine; specifically, to

1. carry out singleton detection
2. get the cardinalities of all bins in a subsampling group (debugging only).
"""

include("query.jl")
include("codes.jl")

"""
MLE value estimation of a singleton given its frequency.
"""
function estimate_value(k::BitArray{1}, D::BitArray{2}, U_slice)
    s_k = (-1) .^ (D * k)
    return (s_k ⋅ U_slice) / length(U_slice), s_k
end

"""
Noiseless-case singleton detection. Assumes P = n + 1 and D = [0; I].
See singleton_detection for full signature.
"""
function singleton_detection_noiseless(U_slice; kwargs...)
    signs = sign_spright.(U_slice / U_slice[1])
    return signs[2:length(signs)], U_slice[1], (-1) .^ signs
end

"""
Singleton detection that uses MLE: looks at the residuals created by peeling off each possible singleton.
See singleton_detection for full signature.
"""
function singleton_detection_mle(U_slice; kwargs...)
    selection, S_slice, n = kwargs[:selection], kwargs[:S_slice], kwargs[:n]
    P = size(S_slice, 1)
    alphas = (1 / P) * S_slice' * U_slice
    residual_vecs = (S_slice * Diagonal(alphas)) .- U_slice
    residuals = dropdims(sum(abs2, residual_vecs, dims=1); dims=1)
    k_sel = argmin(residuals)
    return dec_to_bin(selection[k_sel] - 1, n), alphas[k_sel], S_slice[:, k_sel]
end

"""
Non-sample-optimal singleton detection.
"""
function singleton_detection_nso(U_slice; kwargs...)
    n = kwargs[:n]
    D = kwargs[:D]
    p1 = length(U_slice) ÷ (n + 1)
    chunks = @pipe reshape(U_slice, (n + 1, p1)) |> transpose |> sign_spright.(_)
    chunks = chunks[:,2:n+1] .⊻ chunks[:,1]
    est_k = @pipe sum(chunks, dims=1) |> dropdims(_, dims=1) |> (_ .> (p1 ÷ 2))
    return est_k, estimate_value(est_k, D, U_slice)...
end

"""
Robust sign estimation for sample-optimal singleton detection.
"""
function estimate_sign(U_slice)
    return sum(sign_spright.(U_slice)) > length(U_slice) ÷ 2
end

"""
Sample-optimal singleton detection.
"""
function singleton_detection_so(U_slice; kwargs...)
    n = kwargs[:n]
    p1, p2, p3 = kwargs[:num_delays]
    @assert length(U_slice) == p1+p2+p3
    D = kwargs[:D]
    code = kwargs[:code]

    sgn = estimate_sign(U_slice[p1+1 : p1+p2])
    recvd_codeword = sgn ⊻ sign_spright.(U_slice[p1+p2+1 : p1+p2+p3])
    k = decode_with(recvd_codeword, D, code)
    s_k = (-1) .^ (D * k) # TODO: maybe only use last offsets?
    return k, sgn, s_k
end

singleton_detection_lookup = Dict(
    :mle => singleton_detection_mle,
    :noiseless => singleton_detection_noiseless,
    :nso => singleton_detection_nso,
    :so => singleton_detection_so
)

"""
Finds the true index of a singleton, or the best-approximation singleton of a multiton.

Arguments
---------
U_slice: P-element Array{Float64,1}
The WHT component of a subsampled bin, with element i corresponding to delay i.

Returns
-------
k : n-element Array{Bool,1}
Index of the corresponding right node.
"""
function singleton_detection(U_slice; method=:mle, kwargs...)
    return singleton_detection_lookup[method](U_slice; kwargs...)
end

"""
Computes delayed WHT observations and declares cardinality based on that.
2 is a stand-in for any cardinality > 1. For debugging purposes.

Arguments
---------
signal : TestSignal
The input signal object.

M : n×b Array{Bool,2}
The subsampling matrix; takes on binary values.

D : num_delays×n Array{Int64,2}
The delays matrix.

Returns
-------
(these are still as they are in Python - need to check dims first)
cardinality : numpy.ndarray
0 or 1 if the bin is a zeroton or singleton resp.; 2 if multiton.

singleton_indices : list
A list (in decimal form for compactness) of the k values of the singletons.
Length matches the number of 1s in cardinality.
"""
function bin_cardinality(signal::Signal, M, D; method=:mle, verbose=false)
    b = size(M, 2)
    U, inds = compute_delayed_wht(signal, M, D)
    cardinality = ones(Int64, signal.n) # vector of indicators
    singleton_indices = Int64[]
    cutoff = 2 * signal.noise_sd^2 * (2^(signal.n - b)) * size(D, 1)
    if signal.noise_sd > 0
        K = binary_ints(signal.n)
        S = (-1).^ (D * K)
    end
    col_generator = U |> eachrow |> enumerate
    for (i, col) in col_generator
        sgn = 1
        if verbose
            println("Column:   ", col)
        end
        if col ⋅ col <= cutoff
            cardinality[i] = 0
        else
            if signal.noise_sd == 0
                k, sgn = singleton_detection_noiseless(col)
            else
                selection = @pipe bin_to_dec.(M' * k)' |> findall(==(i), _)
                k, sgn = singleton_detection(col, method=method, selection=selection, S_slice=S[:, selection], n=signal.n)
            end
            rho = @pipe col |> abs.(_) |> mean
            residual = col - sgn * rho * (-1).^ (D * k)
            if verbose
                println("Residual: ", residual)
            end
            if residual ⋅ residual > cutoff
                cardinality[i] = 2
            else
                append!(singleton_indices, bin_to_dec(k))
            end
        end
    end
    return cardinality, singleton_indices
end


text:
include("1.1.4.1 (a x^j+b x^n)^p.jl")
include("1.1.4.2 (c x)^m (a x^j+b x^n)^p.jl")
include("1.1.4.3 (e x)^m (a x^j+b x^k)^p (c+d x^n)^q.jl")
include("1.1.4.4 P(x) (c x)^m (a x^j+b x^n)^p.jl")

max_stars_repo_path: src/rules/1 Algebraic functions/1.1 Binomial products/1.1.4 Improper/.jl


text:
# Tests for ϵ-greedy agents

@testset "ϵ-greedy" begin

noOfArms  = 5

# ϵ-greedy agent
@testset "ϵ-greedy" begin
    agent = epsGreedy( noOfArms, 0.25 )
    @test agent.noOfArms == noOfArms
    for t = 1:10
        armIdx = get_arm_index( agent )
        update_reward!( agent, rand() )
    end
    @test agent.noOfSteps == 10

    @test info_str( agent ) == "ϵ-Greedy (ϵ = 0.250)"
    @test info_str( agent, false ) == "ϵ-Greedy (ϵ = 0.250)"
    @test info_str( agent, true ) == "\$\\epsilon\$-Greedy (\$\\epsilon = 0.250\$)"

    reset!( agent )
    @test agent == epsGreedy(noOfArms,0.25)
end

# ϵₙ-greedy
@testset "ϵₙ-greedy" begin
    agent = epsNGreedy( noOfArms, 0.10, 0.25 )
    @test agent.noOfArms == noOfArms
    for t = 1:10
        armIdx = get_arm_index( agent )
        update_reward!( agent, rand() )
    end
    @test agent.noOfSteps == 10

    @test info_str( agent ) == "ϵₙ-Greedy (c = 0.100, d = 0.250)"
    @test info_str( agent, false ) == "ϵₙ-Greedy (c = 0.100, d = 0.250)"
    @test info_str( agent, true ) == "\$\\epsilon_n\$-Greedy (\$c = 0.100, d = 0.250\$)"

    reset!( agent )
    @test agent == epsNGreedy(noOfArms,0.10,0.25)
end

end


text:
module PricingAlgorithmFH

using Mdp.PricingProblem

export State, add_next_state!, get_next_states, state_transitions, state2id, state_rewards, get_R, get_Q, get_V, get_π, pricing_FH

State = Vector{Int64} # Consider https://github.com/JuliaArrays/StaticArrays.jl for speedup

function add_next_state!(available_prods::Array{Product}, next_states::Array{State}, s::State, product::Product)
    s_next = copy(s)
    for c_i in product
        new_c = s_next[c_i]-1
        if new_c<0
            return
        else
            s_next[c_i] = new_c
        end
    end
    push!(next_states, s_next)
    push!(available_prods, product)
end

function get_next_states(s::State, products)
    next_states::Vector{State} = [s]
    available_prods::Vector{Product} = [()] #Matrix{State}(undef, length(P.C), length(P.products))
    for p in products
        add_next_state!(available_prods, next_states, s, p)
    end
    return available_prods, next_states
end

b = [1,2]
a = Matrix{Float64}(undef,5,5)
a[b...]

"""
    state_transitions(s, k, P.actions, P.products, P)

Compute transition probability matrix for transitions from state `s`. Return
array with next states and the transition table. Rows of the table are indexed
by actions from the problem description, plus the "reject" action. Columns
correspond to next states.

# Examples
see tests.
"""
function state_transitions(s::State, k::Int64, actions::Array{Int64}, products::Array{Product}, P::Problem)
    available_prods, next_states = get_next_states(s, products)

    T_s = Matrix{Float64}(undef, length(actions)+1, length(next_states)) # +1 for action=Infinity
    T_s[end, 2:end].=0.
    T_s[:, 1].=1. # First column is the state transition for empty product ()

    for (i_a, a) in enumerate(actions)
        for (i_p, p) in enumerate(available_prods)
            if p==()
                continue
            else
                p_T = prob_prod_req(p, k, P)*prob_user_accept(a)
                T_s[i_a, i_p] = p_T
                T_s[i_a, 1] -= p_T
            end
        end
    end

    return next_states, T_s
end

"""
    state2id(s)

Convert state to matrix index.
"""
function state2id(s::State)
    return s.+1
end

function state_rewards(actions::Array{Int64})
    R_s = zeros(Float64, length(actions)+1, 2) # 2 columns, one for empty product, one for all others
    # Last row is the "reject" action
    # First column is the state transition for empty product "()"
    R_s[1:(end-1),2].=actions

    return R_s
end

function get_R(s::State, s_next::State, R_s::Matrix{Float64})
    if s==s_next
        return R_s[:, 1]
    else
        return R_s[:, 2]
    end
end

function get_Q(k::Int64, V_next::Matrix{Float64}, P::Problem)
    Q = zeros(Float64, length(P.A)+1, map(length, P.C)...)
    R_s = state_rewards(P.A)

    for s_tuple in P.S
        s = [s_tuple...]
        next_states, T_s = state_transitions(s, k, P.A, P.products, P)
        for (i_s, s_next) in enumerate(next_states)
            p = T_s[:,i_s]
            r = get_R(s, s_next, R_s)
            v = V_next[state2id(s_next)...]
            # tmp = p.*(r.+v)
            # display("$s - $i_s - $s_next p: $tmp")
            Q[:, state2id(s)...].+= p.*(r.+v)
        end
    end
    return Q
end

function get_V(Q_k::Array{Float64, 3})
    # TODO: Merge V and π usinf `findmax` function
    V_k = maximum(Q_k, dims=1)
    V_k = dropdims(V_k, dims=1)
    return V_k
end

function get_π(Q_k::Array{Float64, 3})
    # TODO: Argmax here returns the lowest index for multiple equal values.
    # In deployment, randomizing over the actions could be better.
    # π_k = argmax(Q, dims=1) # returns Cartesian index
    π_k = mapslices(argmax,Q_k, dims=1) # Returns array
    π_k = dropdims(π_k, dims=1)
    return π_k
end

function pricing_FH(P::Problem)
    V_old = zeros(Float64, map(length, P.C)...)
    V_new = similar(V_old)
    # π_star = Array{Float64, 3}(undef,P.N,map(length, P.C)...)
    π_star = Array{Int64, 3}(undef, map(length, P.C)..., P.N)
    for k in P.N:-1:1
        Q_k = get_Q(k, V_old, P)
        V_new = get_V(Q_k)
        # π_star[k, :, :]=π(Q_k)
        π_star[:, :, k]= get_π(Q_k)
        V_old = V_new    # V_new, V_old = V_old, V_new
    end
    return π_star
end

end


text:
module FETermsTests

using Test
using Gridap
using Gridap.SkeletonCellFields: SkeletonCellMatrix
using Gridap.SkeletonCellFields: SkeletonCellVector

ufun(x) = x[1] + x[2]
bfun(x) = x[1]
gfun(x) = x[2]
sfun(x) = x[1]

model = CartesianDiscreteModel(partition=(4,4))

order = 1
diritag = "boundary"
fespace = H1ConformingFESpace(Float64,model,order,diritag)

V = TestFESpace(fespace)
U = TrialFESpace(fespace,ufun)

trian = Triangulation(model)
quad = CellQuadrature(trian,degree=2)

tags = [7,6]
btrian = BoundaryTriangulation(model,tags)
bquad = CellQuadrature(btrian,degree=2)

tags = [9,]
strian = SkeletonTriangulation(model,tags)
squad = CellQuadrature(strian,degree=2)

v = FEBasis(V)
du = FEBasis(U)
uhd = zero(U)
uh = interpolate(U,ufun)

bfield = CellField(trian,bfun)
gfield = CellField(btrian,gfun)
sfield = CellField(strian,sfun)

a(v,u) = inner(v,u)
l(v) = inner(v,bfield)
g(v) = inner(v,gfield)

t1 = AffineFETerm(a,l,trian,quad)

sr = "AffineFETermFromIntegration object"
@test string(t1) == sr
@test sprint(show,"text/plain",t1) == sr

cm = setup_cell_matrix(t1,v,du)
@test isa(cm,CellMatrix)
@test length(cm) == ncells(trian)

cm = setup_cell_jacobian(t1,uh,v,du)
@test isa(cm,CellMatrix)
@test length(cm) == ncells(trian)

cv = setup_cell_vector(t1,v,uhd)
@test isa(cv,CellVector)
@test length(cv) == ncells(trian)

cv = setup_cell_residual(t1,uh,v)
@test isa(cv,CellVector)
@test length(cv) == ncells(trian)

cn = setup_cell_ids(t1)
@test isa(cn,CellNumber)
@test length(cn) == ncells(trian)

t2 = AffineFETerm(a,g,btrian,bquad)

cm = setup_cell_matrix(t2,v,du)
@test isa(cm,CellMatrix)
@test length(cm) == ncells(btrian)

cv = setup_cell_vector(t2,v,uhd)
@test isa(cv,CellVector)
@test length(cv) == ncells(btrian)

cn = setup_cell_ids(t2)
@test isa(cn,CellNumber)
@test length(cn) == ncells(btrian)

sa(v,u) = inner(jump(v),jump(u))
s(v) = inner(jump(v),sfield)

t6 = AffineFETerm(sa,s,strian,squad)

cm = setup_cell_matrix(t6,v,du)
@test isa(cm,SkeletonCellMatrix)

cv = setup_cell_vector(t6,v,uhd)
@test isa(cv,SkeletonCellVector)

cm = setup_cell_jacobian(t6,uh,v,du)
@test isa(cm,SkeletonCellMatrix)

cv = setup_cell_residual(t6,uh,v)
@test isa(cv,SkeletonCellVector)

cn = setup_cell_ids(t6)
@test isa(cn,Tuple{<:CellNumber,<:CellNumber})

t3 = FESource(g,btrian,bquad)

cv = setup_cell_vector(t3,v,uhd)
@test isa(cv,CellVector)
@test length(cv) == ncells(btrian)

cv = setup_cell_residual(t3,uh,v)
@test isa(cv,CellVector)
@test length(cv) == ncells(btrian)

cn = setup_cell_ids(t3)
@test isa(cn,CellNumber)
@test length(cn) == ncells(btrian)

cm = setup_cell_matrix(t3,v,du)
@test cm === nothing

t4 = LinearFETerm(a,trian,quad)

cm = setup_cell_matrix(t4,v,du)
@test isa(cm,CellMatrix)
@test length(cm) == ncells(trian)

cv = setup_cell_vector(t4,v,uhd)
@test isa(cv,CellVector)
@test length(cv) == ncells(trian)

cn = setup_cell_ids(t4)
@test isa(cn,CellNumber)
@test length(cn) == ncells(trian)

jac(uh,v,du) = a(v,du)
res(uh,v) = a(v,uh) - l(v)

t5 = NonLinearFETerm(res,jac,trian,quad)

cm = setup_cell_jacobian(t5,uh,v,du)
@test isa(cm,CellMatrix)
@test length(cm) == ncells(trian)

cv = setup_cell_residual(t5,uh,v)
@test isa(cv,CellVector)
@test length(cv) == ncells(trian)

cn = setup_cell_ids(t5)
@test isa(cn,CellNumber)
@test length(cn) == ncells(trian)

assem = SparseMatrixAssembler(V,U)

cms = setup_cell_jacobian(uh,v,du,t1)

cms = setup_cell_jacobian(uh,v,du,t1,t2,t6)

mat = assemble(assem,cms...)

cvs = setup_cell_residual(uh,v,t1,t2,t6)

vec = assemble(assem,cvs...)

cvs = setup_cell_vector(v,uhd,t1,t2,t6)

vec = assemble(assem,cvs...)

cms = setup_cell_matrix(v,du,t1,t2,t6)

mat = assemble(assem,cms...)

end #module