text:
using Rubin
using Tests
using Elliptic
using HypergeometricFunctions
using Polylogarithms
using SpecialFunctions

@test integrate((a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2)*tan(c+d*x), x) == :(-1*x*(B*a+-1*C*b)+d^-1*(B*a+-1*C*b)*tan(c+d*x)+d^-1*(B*b+C*a)*log(cos(c+d*x))+(1/2)*d^-1*tan(c+d*x)^2*(B*b+C*a)+1//3*C*b*d^-1*tan(c+d*x)^3)
@test integrate((a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*b+C*a)+-1*d^-1*(B*a+-1*C*b)*log(cos(c+d*x))+B*b*d^-1*tan(c+d*x)+(1/2)*C*b^-1*d^-1*(a+b*tan(c+d*x))^2)
@test integrate((a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2)*cot(c+d*x), x) == :(x*(B*a+-1*C*b)+-1*d^-1*(B*b+C*a)*log(cos(c+d*x))+C*b*d^-1*tan(c+d*x))
@test integrate(cot(c+d*x)^2*(a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(B*b+C*a)+B*a*d^-1*log(sin(c+d*x))+-1*C*b*d^-1*log(cos(c+d*x)))
@test integrate(cot(c+d*x)^3*(a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*a+-1*C*b)+d^-1*(B*b+C*a)*log(sin(c+d*x))+-1*B*a*d^-1*cot(c+d*x))
@test integrate(cot(c+d*x)^4*(a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*b+C*a)+-1*d^-1*(B*a+-1*C*b)*log(sin(c+d*x))+-1*d^-1*(B*b+C*a)*cot(c+d*x)+-1//2*B*a*d^-1*cot(c+d*x)^2)
@test integrate(cot(c+d*x)^5*(a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(B*a+-1*C*b)+d^-1*(B*a+-1*C*b)*cot(c+d*x)+-1*d^-1*(B*b+C*a)*log(sin(c+d*x))+-1//2*d^-1*cot(c+d*x)^2*(B*b+C*a)+-1//3*B*a*d^-1*cot(c+d*x)^3)
@test integrate(cot(c+d*x)^6*(a+b*tan(c+d*x))*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(B*b+C*a)+d^-1*(B*a+-1*C*b)*log(sin(c+d*x))+d^-1*(B*b+C*a)*cot(c+d*x)+(1/2)*d^-1*cot(c+d*x)^2*(B*a+-1*C*b)+-1//3*d^-1*cot(c+d*x)^3*(B*b+C*a)+-1//4*B*a*d^-1*cot(c+d*x)^4)
@test integrate((a+b*tan(c+d*x))^2*(B*tan(c+d*x)+C*tan(c+d*x)^2)*tan(c+d*x), x) == :(-1*x*(B*a^2+-1*B*b^2+-2*C*a*b)+d^-1*(C*a^2+-1*C*b^2+2*B*a*b)*log(cos(c+d*x))+-1//2*C*d^-1*(a+b*tan(c+d*x))^2+-1*b*d^-1*(B*b+C*a)*tan(c+d*x)+1//12*b^-2*d^-1*(a+b*tan(c+d*x))^3*(-1*C*a+4*B*b)+1//4*C*b^-1*d^-1*(a+b*tan(c+d*x))^3*tan(c+d*x))
@test integrate((a+b*tan(c+d*x))^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(C*a^2+-1*C*b^2+2*B*a*b)+(1/2)*B*d^-1*(a+b*tan(c+d*x))^2+-1*d^-1*(B*a^2+-1*B*b^2+-2*C*a*b)*log(cos(c+d*x))+b*d^-1*(B*a+-1*C*b)*tan(c+d*x)+1//3*C*b^-1*d^-1*(a+b*tan(c+d*x))^3)
@test integrate((a+b*tan(c+d*x))^2*(B*tan(c+d*x)+C*tan(c+d*x)^2)*cot(c+d*x), x) == :(x*(B*a^2+-1*B*b^2+-2*C*a*b)+(1/2)*C*d^-1*(a+b*tan(c+d*x))^2+-1*d^-1*(C*a^2+-1*C*b^2+2*B*a*b)*log(cos(c+d*x))+b*d^-1*(B*b+C*a)*tan(c+d*x))
@test integrate((a+b*tan(c+d*x))^2*cot(c+d*x)^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(C*a^2+-1*C*b^2+2*B*a*b)+B*a^2*d^-1*log(sin(c+d*x))+C*b^2*d^-1*tan(c+d*x)+-1*b*d^-1*(B*b+2*C*a)*log(cos(c+d*x)))
@test integrate((a+b*tan(c+d*x))^2*cot(c+d*x)^3*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*a^2+-1*B*b^2+-2*C*a*b)+a*d^-1*(C*a+2*B*b)*log(sin(c+d*x))+-1*B*a^2*d^-1*cot(c+d*x)+-1*C*b^2*d^-1*log(cos(c+d*x)))
@test integrate((a+b*tan(c+d*x))^2*cot(c+d*x)^4*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(C*b^2+-1*a*(C*a+2*B*b))+-1*d^-1*(B*a^2+-1*B*b^2+-2*C*a*b)*log(sin(c+d*x))+-1*a*d^-1*(C*a+2*B*b)*cot(c+d*x)+-1//2*B*a^2*d^-1*cot(c+d*x)^2)
@test integrate((a+b*tan(c+d*x))^2*cot(c+d*x)^5*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(B*a^2+-1*B*b^2+-2*C*a*b)+d^-1*(C*b^2+-1*a*(C*a+2*B*b))*log(sin(c+d*x))+d^-1*(B*a^2+-1*B*b^2+-2*C*a*b)*cot(c+d*x)+-1//2*a*d^-1*cot(c+d*x)^2*(C*a+2*B*b)+-1//3*B*a^2*d^-1*cot(c+d*x)^3)
@test integrate((a+b*tan(c+d*x))^2*cot(c+d*x)^6*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(C*a^2+-1*C*b^2+2*B*a*b)+d^-1*(B*a^2+-1*B*b^2+-2*C*a*b)*log(sin(c+d*x))+(1/2)*d^-1*cot(c+d*x)^2*(B*a^2+-1*B*b^2+-2*C*a*b)+-1*d^-1*(C*b^2+-1*a*(C*a+2*B*b))*cot(c+d*x)+-1//3*a*d^-1*cot(c+d*x)^3*(C*a+2*B*b)+-1//4*B*a^2*d^-1*cot(c+d*x)^4)
@test integrate((a+b*tan(c+d*x))^3*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)+(1/2)*d^-1*(a+b*tan(c+d*x))^2*(B*a+-1*C*b)+-1*d^-1*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)*log(cos(c+d*x))+1//3*B*d^-1*(a+b*tan(c+d*x))^3+b*d^-1*(B*a^2+-1*B*b^2+-2*C*a*b)*tan(c+d*x)+1//4*C*b^-1*d^-1*(a+b*tan(c+d*x))^4)
@test integrate((a+b*tan(c+d*x))^3*(B*tan(c+d*x)+C*tan(c+d*x)^2)*cot(c+d*x), x) == :(x*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)+(1/2)*d^-1*(a+b*tan(c+d*x))^2*(B*b+C*a)+-1*d^-1*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)*log(cos(c+d*x))+1//3*C*d^-1*(a+b*tan(c+d*x))^3+b*d^-1*(C*a^2+-1*C*b^2+2*B*a*b)*tan(c+d*x))
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)+B*a^3*d^-1*log(sin(c+d*x))+b^2*d^-1*(B*b+2*C*a)*tan(c+d*x)+(1/2)*C*b*d^-1*(a+b*tan(c+d*x))^2+-1*b*d^-1*(-1*C*b^2+3*C*a^2+3*B*a*b)*log(cos(c+d*x)))
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^3*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)+a^2*d^-1*(C*a+3*B*b)*log(sin(c+d*x))+b^2*d^-1*(B*a+C*b)*tan(c+d*x)+-1*b^2*d^-1*(B*b+3*C*a)*log(cos(c+d*x))+-1*B*a*d^-1*(a+b*tan(c+d*x))^2*cot(c+d*x))
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^4*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)+-1*C*b^3*d^-1*log(cos(c+d*x))+-1*a*d^-1*(B*a^2+-3*B*b^2+-3*C*a*b)*log(sin(c+d*x))+-1*a^2*d^-1*(C*a+2*B*b)*cot(c+d*x)+-1//2*B*a*d^-1*(a+b*tan(c+d*x))^2*cot(c+d*x)^2)
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^5*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)+-1*d^-1*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)*log(sin(c+d*x))+-1//6*a^2*d^-1*cot(c+d*x)^2*(3*C*a+5*B*b)+1//3*a*d^-1*(-8*B*b^2+3*B*a^2+-9*C*a*b)*cot(c+d*x)+-1//3*B*a*d^-1*(a+b*tan(c+d*x))^2*cot(c+d*x)^3)
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^6*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)+d^-1*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)*log(sin(c+d*x))+d^-1*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)*cot(c+d*x)+-1//6*a^2*d^-1*cot(c+d*x)^3*(2*C*a+3*B*b)+1//4*a*d^-1*cot(c+d*x)^2*(-5*B*b^2+2*B*a^2+-6*C*a*b)+-1//4*B*a*d^-1*(a+b*tan(c+d*x))^2*cot(c+d*x)^4)
@test integrate((a+b*tan(c+d*x))^3*cot(c+d*x)^7*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)+d^-1*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)*log(sin(c+d*x))+(1/2)*d^-1*cot(c+d*x)^2*(C*a^3+-1*B*b^3+-3*C*a*b^2+3*B*b*a^2)+-1*d^-1*(B*a^3+C*b^3+-3*B*a*b^2+-3*C*b*a^2)*cot(c+d*x)+-1//20*a^2*d^-1*cot(c+d*x)^4*(5*C*a+7*B*b)+1//15*a*d^-1*cot(c+d*x)^3*(-12*B*b^2+5*B*a^2+-15*C*a*b)+-1//5*B*a*d^-1*(a+b*tan(c+d*x))^2*cot(c+d*x)^5)
@test integrate((a+b*tan(c+d*x))^-1*tan(c+d*x)^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(a^2+b^2)^-1*(B*b+-1*C*a)+b^-2*d^-1*(B*b+-1*C*a)*tan(c+d*x)+d^-1*(a^2+b^2)^-1*(B*a+C*b)*log(cos(c+d*x))+(1/2)*C*b^-1*d^-1*tan(c+d*x)^2+-1*a^3*b^-3*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a+b*tan(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*(B*tan(c+d*x)+C*tan(c+d*x)^2)*tan(c+d*x), x) == :(-1*x*(a^2+b^2)^-1*(B*a+C*b)+C*b^-1*d^-1*tan(c+d*x)+-1*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(cos(c+d*x))+a^2*b^-2*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a+b*tan(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(a^2+b^2)^-1*(B*b+-1*C*a)+-1*d^-1*(a^2+b^2)^-1*(B*a+C*b)*log(cos(c+d*x))+-1*a*b^-1*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a+b*tan(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*(B*tan(c+d*x)+C*tan(c+d*x)^2)*cot(c+d*x), x) == :(x*(a^2+b^2)^-1*(B*a+C*b)+d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a*cos(c+d*x)+b*sin(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*cot(c+d*x)^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(a^2+b^2)^-1*(B*b+-1*C*a)+B*a^-1*d^-1*log(sin(c+d*x))+-1*b*a^-1*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a*cos(c+d*x)+b*sin(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*cot(c+d*x)^3*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(a^2+b^2)^-1*(B*a+C*b)+-1*B*a^-1*d^-1*cot(c+d*x)+-1*a^-2*d^-1*(B*b+-1*C*a)*log(sin(c+d*x))+a^-2*b^2*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a*cos(c+d*x)+b*sin(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-1*cot(c+d*x)^4*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(a^2+b^2)^-1*(B*b+-1*C*a)+a^-2*d^-1*(B*b+-1*C*a)*cot(c+d*x)+-1*a^-3*d^-1*(B*a^2+-1*B*b^2+C*a*b)*log(sin(c+d*x))+-1//2*B*a^-1*d^-1*cot(c+d*x)^2+-1*a^-3*b^3*d^-1*(a^2+b^2)^-1*(B*b+-1*C*a)*log(a*cos(c+d*x)+b*sin(c+d*x)))
@test integrate((a+b*tan(c+d*x))^-2*tan(c+d*x)^2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(-1*x*(a^2+b^2)^-2*(C*b^2+-1*C*a^2+2*B*a*b)+d^-1*(a^2+b^2)^-2*(B*a^2+-1*B*b^2+2*C*a*b)*log(cos(c+d*x))+-1*b^-2*d^-1*(a^2+b^2)^-1*(-1*C*b^2+-2*C*a^2+B*a*b)*tan(c+d*x)+a^2*b^-3*d^-1*(a^2+b^2)^-2*(-2*C*a^3+3*B*b^3+B*b*a^2+-4*C*a*b^2)*log(a+b*tan(c+d*x))+a*b^-1*d^-1*(a+b*tan(c+d*x))^-1*(a^2+b^2)^-1*tan(c+d*x)^2*(B*b+-1*C*a))
@test integrate((a+b*tan(c+d*x))^-2*(B*tan(c+d*x)+C*tan(c+d*x)^2)*tan(c+d*x), x) == :(-1*x*(a^2+b^2)^-2*(B*a^2+-1*B*b^2+2*C*a*b)+-1*d^-1*(a^2+b^2)^-2*(C*b^2+-1*C*a^2+2*B*a*b)*log(cos(c+d*x))+-1*a*b^-2*d^-1*(a^2+b^2)^-2*(-1*C*a^3+2*B*b^3+-3*C*a*b^2)*log(a+b*tan(c+d*x))+-1*a^2*b^-2*d^-1*(a+b*tan(c+d*x))^-1*(a^2+b^2)^-1*(B*b+-1*C*a))
@test integrate((a+b*tan(c+d*x))^-2*(B*tan(c+d*x)+C*tan(c+d*x)^2), x) == :(x*(a^2+b^2)^-2*(C*b^2+-1*C*a^2+2*B*a*b)+-1*d^-1*(a^2+b^2)^-2*(B*a^2+-1*B*b^2+2*C*a*b)*log(a*cos(c+d*x)+b*sin(c+d*x))+a*b^-1*d^-1*(a+b*tan(c+d*x))^-1*(a^2+b^2)^-1*(B*b+-1*C*a))
@test integrate((a+b*tan(c+d*x))^-2*(B*tan(c+d*x)+C*tan(c+d*x)^2)*cot(c+d*x), x) == :(x*(a^2+b^2)^-2*(B*a^2+-1*B*b^2+2*C*a*b)+d^-1*(a^2+b^2)^-2*(C*b^2+-1*C*a^2+2*B*a*b)*log(a*cos(c+d*x)+b*sin(c+d*x))+-1*d^-1*(a+b*tan(c+d*x))^-1*(a^2+b^2)^-1*(B*b+-1*C*a))
@test integrate((a+b*tan(c+d*x))^-2*cot(c+d*x)^2*(B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+f*x)^2), x) == :(x*(a^2*(A*c+-1*B*d+-1*C*c)+-1*b^2*(A*c+-1*B*d+-1*C*c)+-2*a*b*(B*c+d*(A+-1C)))+(1/2)*f^-1*(a+b*tan(e+f*x))^2*(B*c+d*(A+-1C))+-1*f^-1*(a^2*(B*c+d*(A+-1C))+-1*b^2*(B*c+d*(A+-1C))+2*a*b*(A*c+-1*B*d+-1*C*c))*log(cos(e+f*x))+b*f^-1*(A*a*d+A*b*c+B*a*c+-1*B*b*d+-1*C*a*d+-1*C*b*c)*tan(e+f*x)+-1//12*b^-2*f^-1*(a+b*tan(e+f*x))^3*(-4*b*(B*d+C*c)+C*a*d)+1//4*C*d*b^-1*f^-1*(a+b*tan(e+f*x))^3*tan(e+f*x))
@test integrate((a+b*tan(e+f*x))*(c+d*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(a*(A*c+-1*B*d+-1*C*c)+-1*b*(B*c+d*(A+-1C)))+-1*f^-1*(A*a*d+A*b*c+B*a*c+-1*B*b*d+-1*C*a*d+-1*C*b*c)*log(cos(e+f*x))+d*f^-1*(A*b+B*a+-1*C*b)*tan(e+f*x)+-1//6*d^-2*f^-1*(c+d*tan(e+f*x))^2*(C*b*c+-3*B*b*d+-3*C*a*d)+1//3*C*b*d^-1*f^-1*(c+d*tan(e+f*x))^2*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(A*c+-1*B*d+-1*C*c)+-1*f^-1*(B*c+d*(A+-1C))*log(cos(e+f*x))+B*d*f^-1*tan(e+f*x)+(1/2)*C*d^-1*f^-1*(c+d*tan(e+f*x))^2)
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(a^2+b^2)^-1*(a*(A*c+-1*B*d+-1*C*c)+b*(B*c+d*(A+-1C)))+f^-1*(a^2+b^2)^-1*(A*b*c+C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b*d+-1*C*a*d)*tan(e+f*x)+d^-3*f^-1*(c^2+d^2)^-1*(b*c+-1*a*d)^2*(A*d^2+C*c^2+-1*B*c*d)*log(c+d*tan(e+f*x)))
@test integrate((c+d*tan(e+f*x))^-1*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(c^2+d^2)^-1*(a*(A*c+B*d+-1*C*c)+-1*b*(B*c+-1*d*(A+-1C)))+-1*f^-1*(c^2+d^2)^-1*(A*b*c+B*a*c+B*b*d+C*a*d+-1*A*a*d+-1*C*b*c)*log(cos(e+f*x))+C*b*d^-1*f^-1*tan(e+f*x)+-1*d^-2*f^-1*(c^2+d^2)^-1*(b*c+-1*a*d)*(A*d^2+C*c^2+-1*B*c*d)*log(c+d*tan(e+f*x)))
@test integrate((c+d*tan(e+f*x))^-1*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(c^2+d^2)^-1*(A*c+B*d+-1*C*c)+-1*f^-1*(c^2+d^2)^-1*(B*c+-1*d*(A+-1C))*log(cos(e+f*x))+d^-1*f^-1*(c^2+d^2)^-1*(A*d^2+C*c^2+-1*B*c*d)*log(c+d*tan(e+f*x)))
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^-1*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(a^2+b^2)^-1*(c^2+d^2)^-1*(a*(A*c+B*d+-1*C*c)+b*(B*c+-1*d*(A+-1C)))+f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^-1*(A*b^2+-1*a*(B*b+-1*C*a))*log(a*cos(e+f*x)+b*sin(e+f*x))+-1*f^-1*(c^2+d^2)^-1*(b*c+-1*a*d)^-1*(A*d^2+C*c^2+-1*B*c*d)*log(c*cos(e+f*x)+d*sin(e+f*x)))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^-1*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(x*(a^2+b^2)^-2*(c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*(a^2*d^2+b^2*(2*c^2+3*d^2))+a^2*(2*C*d^2+3*C*c^2+-1*B*c*d)+c*b^2*(C*c+-1*B*d)+-2*B*a*b*(c^2+d^2)))
@test integrate((a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*b^3*(A+-1C)+2*B*a^3+-6*B*a*b^2+6*b*a^2*(A+-1C))+1//315*d^-4*f^-1*(c+d*tan(e+f*x))^3//2*(-2*b^3*(16*C*c^3+105*B*d^3+-24*B*d*c^2+42*c*d^2*(A+-1C))+80*C*a^3*d^3+-12*b*a^2*d^2*(-45*B*d+16*C*c)+18*a*d*b^2*(d^2*(-35C+35A)+8*C*c^2+-14*B*c*d))+f^-1*(a+im*b)^3*(c+im*d)^(1/2)*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^3*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1//21*d^-2*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^3//2*(-6*B*b*d+-4*C*a*d+4*C*b*c)+2//9*C*d^-1*f^-1*(a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^3//2+2//105*b*d^-3*f^-1*(c+d*tan(e+f*x))^3//2*((-4*a*d+4*b*c)*(-3*B*b*d+-2*C*a*d+2*C*b*c)+21*b*d^2*(A*b+B*a+-1*C*b))*tan(e+f*x))
@test integrate((a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*B*b^2+2*B*a^2+4*a*b*(A+-1C))+1//105*d^-3*f^-1*(c+d*tan(e+f*x))^3//2*(2*b^2*(d^2*(-35C+35A)+8*C*c^2+-14*B*c*d)+40*C*a^2*d^2+-28*a*b*d*(-5*B*d+2*C*c))+-1*f^-1*(a+im*b)^2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^2*(c+-1*im*d)^(1/2)*(B+im*(A+-1C))*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//7*C*d^-1*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^3//2+-2//35*b*d^-2*f^-1*(c+d*tan(e+f*x))^3//2*(-7*B*b*d+-4*C*a*d+4*C*b*c)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^(1/2)*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*C*b+2*A*b+2*B*a)+-1//15*d^-2*f^-1*(c+d*tan(e+f*x))^3//2*(-10*B*b*d+-10*C*a*d+4*C*b*c)+f^-1*(c+im*d)^(1/2)*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^(1/2)*(b+im*a)*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//5*C*b*d^-1*f^-1*(c+d*tan(e+f*x))^3//2*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(2*B*f^-1*(c+d*tan(e+f*x))^(1/2)+-1*f^-1*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//3*C*d^-1*f^-1*(c+d*tan(e+f*x))^3//2)
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(2*C*b^-1*f^-1*(c+d*tan(e+f*x))^(1/2)+f^-1*(a+im*b)^-1*(c+im*d)^(1/2)*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-1*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^-3//2*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^(1/2)*(-2*a*(B*b+-1*C*a)+2*A*b^2)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(A*b^2+-1*a*(B*b+-1*C*a))+-1*b^-3//2*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^-1//2*(b^4*(A*d+2*B*c)+C*d*a^4+a*b^3*(-4*C*c+-3*B*d+4*A*c)+-1*a^2*b^2*(-5*C*d+2*B*c+3*A*d)+B*b*d*a^3)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-3*(c+d*tan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1*B*d+-1*C*c))+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(-2*b^3*(A+-1C)+2*B*a^3+-6*B*a*b^2+6*b*a^2*(A+-1C))+1//3465*d^-4*f^-1*(c+d*tan(e+f*x))^5//2*(-2*b^3*(48*C*c^3+693*B*d^3+-88*B*d*c^2+198*c*d^2*(A+-1C))+336*C*a^3*d^3+-4*b*a^2*d^2*(-847*B*d+192*C*c)+66*a*d*b^2*(d^2*(-63C+63A)+8*C*c^2+-18*B*c*d))+f^-1*(a+im*b)^3*(c+im*d)^3//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+f^-1*(b+im*a)^3*(c+-1*im*d)^3//2*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1//99*d^-2*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^5//2*(-22*B*b*d+-12*C*a*d+12*C*b*c)+2//11*C*d^-1*f^-1*(a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^5//2+2//693*b*d^-3*f^-1*(c+d*tan(e+f*x))^5//2*((-4*a*d+4*b*c)*(-11*B*b*d+-6*C*a*d+6*C*b*c)+99*b*d^2*(A*b+B*a+-1*C*b))*tan(e+f*x))
@test integrate((a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*b^2*(B*c+d*(A+-1C))+2*a^2*(B*c+d*(A+-1C))+4*a*b*(A*c+-1*B*d+-1*C*c))+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(-2*B*b^2+2*B*a^2+4*a*b*(A+-1C))+1//315*d^-3*f^-1*(c+d*tan(e+f*x))^5//2*(2*b^2*(d^2*(-63C+63A)+8*C*c^2+-18*B*c*d)+56*C*a^2*d^2+-36*a*b*d*(-7*B*d+2*C*c))+f^-1*(a+im*b)^2*(c+im*d)^3//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^2*(c+-1*im*d)^3//2*(B+im*(A+-1C))*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//9*C*d^-1*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^5//2+-2//63*b*d^-2*f^-1*(c+d*tan(e+f*x))^5//2*(-9*B*b*d+-4*C*a*d+4*C*b*c)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^3//2*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*B*b*d+-2*C*a*d+-2*C*b*c+2*A*a*d+2*A*b*c+2*B*a*c)+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(-2*C*b+2*A*b+2*B*a)+-1//35*d^-2*f^-1*(c+d*tan(e+f*x))^5//2*(-14*B*b*d+-14*C*a*d+4*C*b*c)+f^-1*(c+im*d)^3//2*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^3//2*(b+im*a)*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//7*C*b*d^-1*f^-1*(c+d*tan(e+f*x))^5//2*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(2*B*c+2*d*(A+-1C))+2//3*B*f^-1*(c+d*tan(e+f*x))^3//2+-1*f^-1*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//5*C*d^-1*f^-1*(c+d*tan(e+f*x))^5//2)
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(b^-2*f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*C*a*d+2*B*b*d+2*C*b*c)+2//3*C*b^-1*f^-1*(c+d*tan(e+f*x))^3//2+-1*f^-1*(a+-1*im*b)^-1*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*f^-1*(c+im*d)^3//2*(-1b+im*a)^-1*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*b^-5//2*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^3//2*(-2*a*(B*b+-1*C*a)+2*A*b^2)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+d*b^-2*f^-1*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(A*b^2+2*C*b^2+3*C*a^2+-1*B*a*b)+b^-5//2*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^(1/2)*(-1*b^4*(2*B*c+3*A*d)+a^2*b^2*(d*(A+-7C)+2*B*c)+-1*a*b^3*(-5*B*d+-4*C*c+4*A*c)+-3*C*d*a^4+B*b*d*a^3)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2)+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(A*b^2+-1*a*(B*b+-1*C*a)))
@test integrate((a+b*tan(e+f*x))^-3*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+im*d)^3//2*(-1b+im*a)^-3*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(b+im*a)^-3*(c+-1*im*d)^3//2*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1//2*b^-1*f^-1*(a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(A*b^2+-1*a*(B*b+-1*C*a))+-1//4*b^-2*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(b^4*(3*A*d+4*B*c)+a*b^3*(-8*C*c+-7*B*d+8*A*c)+-1*a^2*b^2*(-11*C*d+4*B*c+5*A*d)+3*C*d*a^4+B*b*d*a^3)+-1//4*b^-5//2*f^-1*(a^2+b^2)^-3*(b*c+-1*a*d)^-1//2*(-1*b^6*(-8*C*c^2+-3*A*d^2+8*A*c^2+-12*B*c*d)+a*b^5*(3*B*(-5*d^2+8*c^2)+40*c*d*(A+-1C))+a^2*b^4*(-26*A*d^2+-24*C*c^2+24*A*c^2+35*C*d^2+-48*B*c*d)+-2*a^3*b^3*(B*(-9*d^2+4*c^2)+12*c*d*(A+-1C))+3*C*a^6*d^2+B*b*a^5*d^2+d*a^4*b^2*(d*(3A+6C)+4*B*c))*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*a^2*(B*(c^2+-1*d^2)+2*c*d*(A+-1C))+2*b^2*(B*(c^2+-1*d^2)+2*c*d*(A+-1C))+4*a*b*(C*c^2+-1*A*(c^2+-1*d^2)+-1*C*d^2+2*B*c*d))+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(-2*b^2*(B*c+d*(A+-1C))+2*a^2*(B*c+d*(A+-1C))+4*a*b*(A*c+-1*B*d+-1*C*c))+1//5*f^-1*(c+d*tan(e+f*x))^5//2*(-2*B*b^2+2*B*a^2+4*a*b*(A+-1C))+1//693*d^-3*f^-1*(c+d*tan(e+f*x))^7//2*(2*b^2*(d^2*(-99C+99A)+8*C*c^2+-22*B*c*d)+72*C*a^2*d^2+-44*a*b*d*(-9*B*d+2*C*c))+f^-1*(a+im*b)^2*(c+im*d)^5//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//11*C*d^-1*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^7//2+-2//99*b*d^-2*f^-1*(c+d*tan(e+f*x))^7//2*(-11*B*b*d+-4*C*a*d+4*C*b*c)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^5//2*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*b*(C*c^2+-1*C*d^2+2*B*c*d)+2*A*(b*(c^2+-1*d^2)+2*a*c*d)+2*a*(B*c^2+-1*B*d^2+-2*C*c*d))+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(-2*B*b*d+-2*C*a*d+-2*C*b*c+2*A*a*d+2*A*b*c+2*B*a*c)+1//5*f^-1*(c+d*tan(e+f*x))^5//2*(-2*C*b+2*A*b+2*B*a)+-1//63*d^-2*f^-1*(c+d*tan(e+f*x))^7//2*(-18*B*b*d+-18*C*a*d+4*C*b*c)+f^-1*(c+im*d)^5//2*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^5//2*(b+im*a)*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//9*C*b*d^-1*f^-1*(c+d*tan(e+f*x))^7//2*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+d*tan(e+f*x))^(1/2)*(2*B*(c^2+-1*d^2)+4*c*d*(A+-1C))+1//3*f^-1*(c+d*tan(e+f*x))^3//2*(2*B*c+2*d*(A+-1C))+2//5*B*f^-1*(c+d*tan(e+f*x))^5//2+-1*f^-1*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//7*C*d^-1*f^-1*(c+d*tan(e+f*x))^7//2)
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(b^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(2*(b*c+-1*a*d)*(B*b*d+C*b*c+-1*C*a*d)+2*d*b^2*(B*c+d*(A+-1C)))+1//3*b^-2*f^-1*(c+d*tan(e+f*x))^3//2*(-2*C*a*d+2*B*b*d+2*C*b*c)+2//5*C*b^-1*f^-1*(c+d*tan(e+f*x))^5//2+f^-1*(a+im*b)^-1*(c+im*d)^5//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-1*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^-7//2*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^5//2*(-2*a*(B*b+-1*C*a)+2*A*b^2)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+b^-7//2*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^3//2*(-1*b^4*(2*B*c+5*A*d)+a^2*b^2*(-1*d*(A+9C)+2*B*c)+-1*a*b^3*(-7*B*d+-4*C*c+4*A*c)+-5*C*d*a^4+3*B*b*d*a^3)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2)+-1*d*b^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(-2*b^3*(B*d+2*C*c)+a*b^2*(B*c+4*C*d)+-1*A*b^2*(b*c+-1*a*d)+-1*b*a^2*(3*B*d+5*C*c)+5*C*d*a^3)+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^5//2*(a^2+b^2)^-1*(A*b^2+-1*a*(B*b+-1*C*a))+1//3*d*b^-2*f^-1*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(2*C*b^2+3*A*b^2+5*C*a^2+-3*B*a*b))
@test integrate((a+b*tan(e+f*x))^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-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(1//105*d^-4*f^-1*(c+d*tan(e+f*x))^(1/2)*(-2*b^3*(48*C*c^3+105*B*d^3+-56*B*d*c^2+70*c*d^2*(A+-1C))+144*C*a^3*d^3+-12*b*a^2*d^2*(-49*B*d+32*C*c)+42*a*d*b^2*(d^2*(-15C+15A)+8*C*c^2+-10*B*c*d))+f^-1*(b+im*a)^3*(c+-1*im*d)^-1//2*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*f^-1*(c+im*d)^-1//2*(-1b+im*a)^3*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1//35*d^-2*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^(1/2)*(-14*B*b*d+-12*C*a*d+12*C*b*c)+2//7*C*d^-1*f^-1*(a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^(1/2)+2//105*b*d^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*((-4*a*d+4*b*c)*(-7*B*b*d+-6*C*a*d+6*C*b*c)+35*b*d^2*(A*b+B*a+-1*C*b))*tan(e+f*x))
@test integrate((a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(1//15*d^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(2*b^2*(d^2*(-15C+15A)+8*C*c^2+-10*B*c*d)+24*C*a^2*d^2+-20*a*b*d*(-3*B*d+2*C*c))+f^-1*(a+im*b)^2*(c+im*d)^-1//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^2*(c+-1*im*d)^-1//2*(B+im*(A+-1C))*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//5*C*d^-1*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^(1/2)+-2//15*b*d^-2*f^-1*(c+d*tan(e+f*x))^(1/2)*(-5*B*b*d+-4*C*a*d+4*C*b*c)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^-1//2*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1//3*d^-2*f^-1*(c+d*tan(e+f*x))^(1/2)*(-6*B*b*d+-6*C*a*d+4*C*b*c)+f^-1*(c+im*d)^-1//2*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^-1//2*(b+im*a)*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2//3*C*b*d^-1*f^-1*(c+d*tan(e+f*x))^(1/2)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(c+im*d)^-1//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2*C*d^-1*f^-1*(c+d*tan(e+f*x))^(1/2))
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+-1*im*b)^-1*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*f^-1*(c+im*d)^-1//2*(-1b+im*a)^-1*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*b^-1//2*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^-1//2*(-2*a*(B*b+-1*C*a)+2*A*b^2)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^-1//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^-1//2*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^-3//2*(b^4*(-1*A*d+2*B*c)+a*b^3*(-1*B*d+-4*C*c+4*A*c)+-1*C*d*a^4+-1*a^2*b^2*(-3*C*d+2*B*c+5*A*d)+3*B*b*d*a^3)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2)+-1*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(b*c+-1*a*d)^-1*(A*b^2+-1*a*(B*b+-1*C*a)))
@test integrate((a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+-1*im*b)^3*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*f^-1*(c+im*d)^-3//2*(-1b+im*a)^3*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*d^-1*f^-1*(a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+2//15*b*d^-4*f^-1*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(b^2*(d^4*(-15C+15A)+48*C*c^4+-40*B*d*c^3+-25*B*c*d^3+6*c^2*d^2*(3C+5A))+6*a^2*d^2*(d^2*(5A+7C)+12*C*c^2+-5*B*c*d)+-15*a*b*d*(-3*B*d^3+8*C*c^3+c*d^2*(3A+5C)+-6*B*d*c^2))+-2//15*b^2*d^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*((-4*a*d+4*b*c)*(d^2*(C+5A)+6*C*c^2+-5*B*c*d)+-5*d^2*(B*(a*c+b*d)+(A+-1C)*(b*c+-1*a*d)))*tan(e+f*x)+2//5*b*d^-2*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(d^2*(C+5A)+6*C*c^2+-5*B*c*d))
@test integrate((a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*d^-1*f^-1*(a+b*tan(e+f*x))^2*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+2//3*b*d^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(-1*b*(-3*B*d^3+8*C*c^3+c*d^2*(3A+5C)+-6*B*d*c^2)+6*a*d*(d^2*(A+C)+2*C*c^2+-1*B*c*d))+2//3*b^2*d^-2*f^-1*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(d^2*(C+3A)+4*C*c^2+-3*B*c*d)*tan(e+f*x))
@test integrate((c+d*tan(e+f*x))^-3//2*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+im*d)^-3//2*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^-3//2*(b+im*a)*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+2*C*b*d^-2*f^-1*(c+d*tan(e+f*x))^(1/2)+d^-2*f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(-2*a*d+2*b*c)*(A*d^2+C*c^2+-1*B*c*d))
@test integrate((c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*d^-1*f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1*(c+im*d)^-3//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+f^-1*(b+im*a)^-1*(c+-1*im*d)^-3//2*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(b*c+-1*a*d)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+-2*b^(1/2)*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^-3//2*(A*b^2+-1*a*(B*b+-1*C*a))*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^(1/2)*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^-5//2*(b^4*(-3*A*d+2*B*c)+a*b^3*(B*d+-4*C*c+4*A*c)+-1*a^2*b^2*(d*(-1C+7A)+2*B*c)+-3*C*d*a^4+5*B*b*d*a^3)*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2)+-1*f^-1*(a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^-1//2*(a^2+b^2)^-1*(b*c+-1*a*d)^-1*(A*b^2+-1*a*(B*b+-1*C*a))+-1*d*f^-1*(c+d*tan(e+f*x))^-1//2*(a^2+b^2)^-1*(c^2+d^2)^-1*(b*c+-1*a*d)^-2*(A*(b^2*(c^2+3*d^2)+2*a^2*d^2)+a^2*(C*d^2+3*C*c^2+-2*B*c*d)+2*c*b^2*(C*c+-1*B*d)+-1*B*a*b*(c^2+d^2)))
@test integrate((a+b*tan(e+f*x))^3*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+-1*im*b)^3*(c+-1*im*d)^-5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*f^-1*(c+im*d)^-5//2*(-1b+im*a)^3*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*d^-2*f^-1*(a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^-1//2*(c^2+d^2)^-2*(b*(4*A*d^4+4*C*c^4+-1*B*d*c^3+-7*B*c*d^3+-2*c^2*d^2*(A+-5C))+3*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C)))*(-2*a*d+2*b*c)+2//3*b^2*d^-3*f^-1*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(d^2*(A+3C)+4*C*c^2+-1*B*c*d))
@test integrate((c+d*tan(e+f*x))^-5//2*(a+b*tan(e+f*x))*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(c+im*d)^-5//2*(-1b+im*a)*(A+-1C+im*B)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*d^-2*f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(2*b*(A*d^4+C*c^4+-1*c^2*d^2*(A+-3C)+-2*B*c*d^3)+2*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C)))+-1*f^-1*(c+-1*im*d)^-5//2*(a+-1*im*b)*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+1//3*d^-2*f^-1*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(-2*a*d+2*b*c)*(A*d^2+C*c^2+-1*B*c*d))
@test integrate((c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(c+im*d)^-5//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(-2*B*(c^2+-1*d^2)+4*c*d*(A+-1C))+-1*f^-1*(c+-1*im*d)^-5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1//3*d^-1*f^-1*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^-1*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1*(c+im*d)^-5//2*(-1B+im*A+-1*im*C)*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+f^-1*(b+im*a)^-1*(c+-1*im*d)^-5//2*(A+-1C+-1*im*B)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+f^-1*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(-3*a*d+3*b*c)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+f^-1*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(b*c+-1*a*d)^-2*(2*b*(A*d^4+C*c^4+c^2*d^2*(-1C+3A)+-2*B*d*c^3)+-2*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C)))+-2*b^3//2*f^-1*(a^2+b^2)^-1*(b*c+-1*a*d)^-5//2*(A*b^2+-1*a*(B*b+-1*C*a))*arctanh(b^(1/2)*(c+d*tan(e+f*x))^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*tan(e+f*x))^-2*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-2*(c+im*d)^-5//2*(B+-1*im*(A+-1C))*arctanh((c+im*d)^-1//2*(c+d*tan(e+f*x))^(1/2))+-1*f^-1*(a+-1*im*b)^-2*(c+-1*im*d)^-5//2*(B+im*A+-1*im*C)*arctanh((c+d*tan(e+f*x))^(1/2)*(c+-1*im*d)^-1//2)+-1*b^3//2*f^-1*(a^2+b^2)^-2*(b*c+-1*a*d)^-7//2*(b^4*(-5*A*d+2*B*c)+a*b^3*(-4*C*c+3*B*d+4*A*c)+-1*a^2*b^2*(d*(C+9A)+2*B*c)+-5*C*d*a^4+7*B*b*d*a^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x))^3//2*(c+d*tan(e+f*x))^3//2*(-8*B*b*d+-5*C*a*d+5*C*b*c)+-1//64*b^-3//2*d^-7//2*f^-1*(b^4*(d^4*(-128C+128A)+5*C*c^4+-8*B*d*c^3+16*c^2*d^2*(A+-1C)+64*B*c*d^3)+5*C*a^4*d^4+-20*a*d*b^3*(C*c^3+-16*B*d^3+-2*B*d*c^2+8*c*d^2*(A+-1C))+-20*b*a^3*d^3*(C*c+2*B*d)+30*a^2*b^2*d^2*(C*c^2+-1*d^2*(-8C+8A)+-4*B*c*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//4*C*d^-1*f^-1*(a+b*tan(e+f*x))^5//2*(c+d*tan(e+f*x))^3//2+1//32*d^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*((b*c+-1*a*d)*(-8*B*b*d+-5*C*a*d+5*C*b*c)+16*b*d^2*(A*b+B*a+-1*C*b))+1//64*b^-1*d^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(-1*(b*c+-1*a*d)*((b*c+-1*a*d)*(-8*B*b*d+-5*C*a*d+5*C*b*c)+16*b*d^2*(A*b+B*a+-1*C*b))+64*b*d^3*(B*a^2+-1*B*b^2+2*a*b*(A+-1C))))
@test integrate((a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^3//2*(c+im*d)^(1/2)*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^3//2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//4*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(C*b*c+-1*C*a*d+-2*B*b*d)+-1//8*b^-3//2*d^-5//2*f^-1*(-1*b^3*(C*c^3+-16*B*d^3+-2*B*d*c^2+8*c*d^2*(A+-1C))+C*a^3*d^3+-3*b*a^2*d^2*(C*c+2*B*d)+3*a*d*b^2*(C*c^2+-1*d^2*(-8C+8A)+-4*B*c*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//3*C*d^-1*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^3//2+1//8*b^-1*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*((b*c+-1*a*d)*(C*b*c+-1*C*a*d+-2*B*b*d)+8*b*d^2*(A*b+B*a+-1*C*b)))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :((1/2)*C*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2+-1*f^-1*(a+im*b)^(1/2)*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//4*b^-3//2*d^-3//2*f^-1*(b^2*(C*c^2+-1*d^2*(-8C+8A)+-4*B*c*d)+C*a^2*d^2+-2*a*b*d*(C*c+2*B*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1//4*b^-1*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(C*b*c+-1*C*a*d+-4*B*b*d))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(C*b^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)+b^-3//2*d^-1//2*f^-1*(C*b*c+-1*C*a*d+2*B*b*d)*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+im*b)^-1//2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2)))
@test integrate((a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-3//2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-3//2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^-3//2*d^(1/2)*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2))
@test integrate((a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-5//2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-5//2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//3*b^-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//3*b^-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(b*c+-1*a*d)^-1*(2*b^4*(A*d+3*B*c)+-2*a^2*b^2*(-7*C*d+3*B*c+5*A*d)+2*C*d*a^4+4*a*b^3*(-3*C*c+-2*B*d+3*A*c)+4*B*b*d*a^3))
@test integrate((a+b*tan(e+f*x))^-7//2*(c+d*tan(e+f*x))^(1/2)*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-7//2*(c+im*d)^(1/2)*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-7//2*(c+-1*im*d)^(1/2)*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//5*b^-1*f^-1*(a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//15*b^-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(b*c+-1*a*d)^-1*(2*b^4*(A*d+5*B*c)+-2*a^2*b^2*(-11*C*d+5*B*c+9*A*d)+2*C*d*a^4+4*a*b^3*(-5*C*c+-3*B*d+5*A*c)+8*B*b*d*a^3)+1//15*b^-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-3*(b*c+-1*a*d)^-2*(-2*b^6*(-1*A*(2*d^2+15*c^2)+5*c*(B*d+3*C*c))+-2*a*b^5*(B*(-3*d^2+45*c^2)+40*c*d*(A+-1C))+-2*a^2*b^4*(-45*C*c^2+-29*A*d^2+23*C*d^2+45*A*c^2+-90*B*c*d)+2*a^3*b^3*(B*(-49*d^2+15*c^2)+80*c*d*(A+-1C))+4*C*a^6*d^2+-2*d*a^4*b^2*(-39*C*d+25*B*c+33*A*d)+16*B*b*a^5*d^2))
@test integrate((a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^3//2*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^3//2*(c+-1*im*d)^3//2*(B+im*(A+-1C))*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//24*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^5//2*(-8*B*b*d+-3*C*a*d+3*C*b*c)+1//4*C*d^-1*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^5//2+1//64*b^-5//2*d^-5//2*f^-1*(b^4*(-1*d^4*(-128C+128A)+3*C*c^4+-192*B*c*d^3+-8*B*d*c^3+48*c^2*d^2*(A+-1C))+3*C*a^4*d^4+-12*a*d*b^3*(C*c^3+16*B*d^3+-24*c*d^2*(A+-1C)+-6*B*d*c^2)+-4*b*a^3*d^3*(2*B*d+3*C*c)+6*a^2*b^2*d^2*(d^2*(-8C+8A)+3*C*c^2+12*B*c*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//64*b^-2*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*((b*c+-1*a*d)*((b*c+-1*a*d)*(-8*B*b*d+-3*C*a*d+3*C*b*c)+48*b*d^2*(A*b+B*a+-1*C*b))+64*b*d^3*(B*a^2+-1*B*b^2+2*a*b*(A+-1C)))+1//96*b^-1*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*((b*c+-1*a*d)*(-8*B*b*d+-3*C*a*d+3*C*b*c)+48*b*d^2*(A*b+B*a+-1*C*b)))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^(1/2)*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+1//3*C*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^5//2+1//8*b^-5//2*d^-3//2*f^-1*(-1*b^3*(C*c^3+16*B*d^3+-24*c*d^2*(A+-1C)+-6*B*d*c^2)+C*a^3*d^3+a*d*b^2*(d^2*(-8C+8A)+3*C*c^2+12*B*c*d)+-1*b*a^2*d^2*(2*B*d+3*C*c))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1//12*b^-1*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(C*b*c+-1*C*a*d+-6*B*b*d)+1//8*b^-2*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(-1*(b*c+-1*a*d)*(C*b*c+-1*C*a*d+-6*B*b*d)+8*b*d^2*(A*b+B*a+-1*C*b)))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1//2*(c+im*d)^3//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+(1/2)*C*b^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+1//4*b^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(-3*C*a*d+3*C*b*c+4*B*b*d)+1//4*b^-5//2*d^-1//2*f^-1*(b^2*(d^2*(-8C+8A)+3*C*c^2+12*B*c*d)+3*C*a^2*d^2+-2*a*b*d*(2*B*d+3*C*c))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2))
@test integrate((a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(b^-5//2*d^(1/2)*f^-1*(-3*C*a*d+2*B*b*d+3*C*b*c)*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+im*b)^-3//2*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-3//2*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+d*b^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(C*b^2+2*A*b^2+3*C*a^2+-2*B*a*b))
@test integrate((a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-5//2*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-5//2*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^-5//2*d^3//2*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*b^-2*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(2*b^4*(A*d+B*c)+-2*a^2*b^2*(B*c+d*(A+-3C))+2*C*d*a^4+4*a*b^3*(A*c+-1*B*d+-1*C*c))+-1//3*b^-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2))
@test integrate((a+b*tan(e+f*x))^-7//2*(c+d*tan(e+f*x))^3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-7//2*(c+im*d)^3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-7//2*(c+-1*im*d)^3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//5*b^-1*f^-1*(a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//15*b^-2*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(2*b^4*(3*A*d+5*B*c)+-2*a^2*b^2*(-13*C*d+5*B*c+7*A*d)+4*a*b^3*(-5*C*c+-4*B*d+5*A*c)+6*C*d*a^4+4*B*b*d*a^3)+-1//15*b^-2*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-3*(b*c+-1*a*d)^-1*(2*b^6*(-3*A*(-1*d^2+5*c^2)+5*c*(3*C*c+4*B*d))+-2*a^3*b^3*(B*(-39*d^2+15*c^2)+50*c*d*(A+-1C))+2*a*b^5*(B*(-23*d^2+45*c^2)+70*c*d*(A+-1C))+2*a^2*b^4*(-49*A*d^2+-45*C*c^2+45*A*c^2+58*C*d^2+-90*B*c*d)+6*C*a^6*d^2+2*d*a^4*b^2*(d*(C+8A)+10*B*c)+4*B*b*a^5*d^2))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^(1/2)*(c+im*d)^5//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//64*b^-7//2*d^-3//2*f^-1*(b^4*(d^4*(-128C+128A)+5*C*c^4+-240*c^2*d^2*(A+-1C)+-40*B*d*c^3+320*B*c*d^3)+5*C*a^4*d^4+-4*a*d*b^3*(-16*B*d^3+5*C*c^3+30*B*d*c^2+40*c*d^2*(A+-1C))+-4*b*a^3*d^3*(2*B*d+5*C*c)+2*a^2*b^2*d^2*(d^2*(-8C+8A)+15*C*c^2+20*B*c*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//4*C*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^7//2+-1//24*b^-1*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^5//2*(C*b*c+-1*C*a*d+-8*B*b*d)+1//64*b^-3*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*((b*c+-1*a*d)*(-1*(-5*a*d+5*b*c)*(C*b*c+-1*C*a*d+-8*B*b*d)+48*b*d^2*(A*b+B*a+-1*C*b))+64*b^2*d^2*(A*a*d+A*b*c+B*a*c+-1*B*b*d+-1*C*a*d+-1*C*b*c))+1//96*b^-2*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(-1*(-5*a*d+5*b*c)*(C*b*c+-1*C*a*d+-8*B*b*d)+48*b*d^2*(A*b+B*a+-1*C*b)))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-1//2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//8*b^-7//2*d^-1//2*f^-1*(-1*b^3*(-16*B*d^3+5*C*c^3+30*B*d*c^2+40*c*d^2*(A+-1C))+5*C*a^3*d^3+a*d*b^2*(d^2*(-8C+8A)+15*C*c^2+20*B*c*d)+-3*b*a^2*d^2*(2*B*d+5*C*c))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//3*C*b^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^5//2+1//8*b^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*((b*c+-1*a*d)*(-5*C*a*d+5*C*b*c+6*B*b*d)+8*d*b^2*(B*c+d*(A+-1C)))+1//12*b^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(-5*C*a*d+5*C*b*c+6*B*b*d))
@test integrate((a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-3//2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-3//2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+1//4*b^-7//2*d^(1/2)*f^-1*(b^2*(d^2*(-8C+8A)+15*C*c^2+20*B*c*d)+15*C*a^2*d^2+-6*a*b*d*(2*B*d+5*C*c))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*b^-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^5//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+(1/2)*d*b^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-1*(C*b^2+4*A*b^2+5*C*a^2+-4*B*a*b)+-1//4*d*b^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(-1*b^3*(4*B*d+7*C*c)+a*b^2*(7*C*d+8*B*c)+-8*A*b^2*(b*c+-1*a*d)+-3*b*a^2*(4*B*d+5*C*c)+15*C*d*a^3))
@test integrate((a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(b^-7//2*d^3//2*f^-1*(-5*C*a*d+2*B*b*d+5*C*b*c)*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+im*b)^-5//2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-5//2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//3*b^-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^5//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+1//3*b^-2*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-2*(-2*b^4*(3*B*c+5*A*d)+-10*C*d*a^4+-4*a*b^3*(-4*B*d+-3*C*c+3*A*c)+2*a^2*b^2*(d*(A+-11C)+3*B*c)+4*B*b*d*a^3)+-1*d*b^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(-1*b^4*(d*(C+4A)+2*B*c)+-5*C*d*a^4+-2*a*b^3*(-3*B*d+-2*C*c+2*A*c)+2*a^2*b^2*(B*c+-5*C*d)+2*B*b*d*a^3))
@test integrate((a+b*tan(e+f*x))^-7//2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-7//2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-7//2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^-7//2*d^5//2*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*b^-3*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-3*(2*b^6*(c*(C*c+2*B*d)+-1*A*(c^2+-1*d^2))+-6*a^2*b^4*(C*c^2+-1*A*(c^2+-1*d^2)+-2*C*d^2+2*B*c*d)+-2*a^3*b^3*(B*(c^2+-1*d^2)+2*c*d*(A+-1C))+2*C*a^6*d^2+6*a*b^5*(B*(c^2+-1*d^2)+2*c*d*(A+-1C))+6*C*a^4*b^2*d^2)+-1//3*b^-2*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-2*(2*b^4*(A*d+B*c)+-2*a^2*b^2*(B*c+d*(A+-3C))+2*C*d*a^4+4*a*b^3*(A*c+-1*B*d+-1*C*c))+-1//5*b^-1*f^-1*(a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^5//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2))
@test integrate((a+b*tan(e+f*x))^-9//2*(c+d*tan(e+f*x))^5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-9//2*(c+im*d)^5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-9//2*(c+-1*im*d)^5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//7*b^-1*f^-1*(a+b*tan(e+f*x))^-7//2*(c+d*tan(e+f*x))^5//2*(a^2+b^2)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//35*b^-2*f^-1*(a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^3//2*(a^2+b^2)^-2*(2*b^4*(5*A*d+7*B*c)+-2*a^2*b^2*(-19*C*d+7*B*c+9*A*d)+4*a*b^3*(-7*C*c+-6*B*d+7*A*c)+10*C*d*a^4+4*B*b*d*a^3)+-1//105*b^-3*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-3*(2*b^6*(-5*A*(-3*d^2+7*c^2)+7*c*(5*C*c+8*B*d))+-2*a^3*b^3*(B*(-75*d^2+35*c^2)+98*c*d*(A+-1C))+2*a*b^5*(B*(-71*d^2+105*c^2)+182*c*d*(A+-1C))+6*a^2*b^4*(-39*A*d^2+-35*C*c^2+35*A*c^2+54*C*d^2+-70*B*c*d)+30*C*a^6*d^2+2*d*a^4*b^2*(8*A*d+14*B*c+37*C*d)+12*B*b*a^5*d^2)+-1//105*b^-3*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-4*(b*c+-1*a*d)^-1*(-2*b^8*(5*d*(-49*C*c^2+-3*A*d^2+49*A*c^2)+7*B*(15*c^3+-23*c*d^2))+-4*a*b^7*(-210*C*c^3+88*B*d^3+210*A*c^3+-525*B*d*c^2+-406*A*c*d^2+406*C*c*d^2)+-4*a^3*b^5*(-317*B*d^3+-42*A*(5*c^3+-19*c*d^2)+210*C*c^3+-798*C*c*d^2+700*B*d*c^2)+-2*a^4*b^4*(-311*A*d^3+105*B*c^3+221*C*d^3+-749*B*c*d^2+-525*C*d*c^2+525*A*d*c^2)+4*a^2*b^6*(-261*A*d^3+291*C*d^3+315*B*c^3+-875*C*d*c^2+-812*B*c*d^2+875*A*d*c^2)+30*C*a^8*d^3+4*d*a^5*b^3*(B*(-12*d^2+35*c^2)+56*c*d*(A+-1C))+4*a^6*b^2*d^2*(4*A*d+7*B*c+26*C*d)+12*B*b*a^7*d^3))
@test integrate((a+b*tan(e+f*x))^5//2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^5//2*(c+im*d)^-1//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^5//2*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//12*d^-2*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^(1/2)*(-6*B*b*d+-5*C*a*d+5*C*b*c)+1//3*C*d^-1*f^-1*(a+b*tan(e+f*x))^5//2*(c+d*tan(e+f*x))^(1/2)+1//8*b^-1//2*d^-7//2*f^-1*(-1*b^3*(5*C*c^3+16*B*d^3+-6*B*d*c^2+8*c*d^2*(A+-1C))+5*C*a^3*d^3+-15*b*a^2*d^2*(C*c+-2*B*d)+5*a*d*b^2*(d^2*(-8C+8A)+3*C*c^2+-4*B*c*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+1//8*d^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*((b*c+-1*a*d)*(-6*B*b*d+-5*C*a*d+5*C*b*c)+8*b*d^2*(A*b+B*a+-1*C*b)))
@test integrate((a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^3//2*(c+im*d)^-1//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+(1/2)*C*d^-1*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^(1/2)+-1*f^-1*(a+-1*im*b)^3//2*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//4*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(-4*B*b*d+-3*C*a*d+3*C*b*c)+1//4*b^-1//2*d^-5//2*f^-1*(b^2*(d^2*(-8C+8A)+3*C*c^2+-4*B*c*d)+3*C*a^2*d^2+-6*a*b*d*(C*c+-2*B*d))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(C*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)+f^-1*(a+im*b)^(1/2)*(c+im*d)^-1//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*b^-1//2*d^-3//2*f^-1*(C*b*c+-1*C*a*d+-2*B*b*d)*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2)))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1//2*(c+im*d)^-1//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^-1//2*(B+im*(A+-1C))*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^-1//2*d^-1//2*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2))
@test integrate((a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-3//2*(c+im*d)^-1//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-3//2*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-1*(b*c+-1*a*d)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2))
@test integrate((a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^-1//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-5//2*(c+im*d)^-1//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-5//2*(c+-1*im*d)^-1//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^(1/2)*(3*a^2+3*b^2)^-1*(b*c+-1*a*d)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//3*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^(1/2)*(a^2+b^2)^-2*(b*c+-1*a*d)^-2*(2*b^4*(-2*A*d+3*B*c)+-4*C*d*a^4+-2*a^2*b^2*(-4*C*d+3*B*c+8*A*d)+2*a*b^3*(-1*B*d+-6*C*c+6*A*c)+10*B*b*d*a^3))
@test integrate((a+b*tan(e+f*x))^5//2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^5//2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^5//2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+1//4*b^(1/2)*d^-7//2*f^-1*(b^2*(d^2*(-8C+8A)+15*C*c^2+-12*B*c*d)+15*C*a^2*d^2+-10*a*b*d*(-2*B*d+3*C*c))*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*d^-1*f^-1*(a+b*tan(e+f*x))^5//2*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+(1/2)*b*d^-2*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(d^2*(C+4A)+5*C*c^2+-4*B*c*d)+-1//4*b*d^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*((-3*a*d+3*b*c)*(d^2*(C+4A)+5*C*c^2+-4*B*c*d)+-4*d^2*(B*(a*c+b*d)+(A+-1C)*(b*c+-1*a*d))))
@test integrate((a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*b^(1/2)*d^-5//2*f^-1*(-3*C*a*d+-2*B*b*d+3*C*b*c)*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+im*b)^3//2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^3//2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*d^-1*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+b*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-1*(d^2*(C+2A)+3*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^(1/2)*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^(1/2)*d^-3//2*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1//2*(c+im*d)^-3//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^-3//2*(B+im*(A+-1C))*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-1*(b*c+-1*a*d)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-3//2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-3//2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^-1//2*(a^2+b^2)^-1*(b*c+-1*a*d)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-2*d*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(a^2+b^2)^-1*(c^2+d^2)^-1*(b*c+-1*a*d)^-2*(A*(a^2*d^2+b^2*(c^2+2*d^2))+a^2*(C*d^2+2*C*c^2+-1*B*c*d)+c*b^2*(C*c+-1*B*d)+-1*B*a*b*(c^2+d^2)))
@test integrate((a+b*tan(e+f*x))^-5//2*(c+d*tan(e+f*x))^-3//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^-5//2*(c+im*d)^-3//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-5//2*(c+-1*im*d)^-3//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1*f^-1*(a+b*tan(e+f*x))^-3//2*(c+d*tan(e+f*x))^-1//2*(3*a^2+3*b^2)^-1*(b*c+-1*a*d)^-1*(-2*a*(B*b+-1*C*a)+2*A*b^2)+-1//3*f^-1*(a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^-1//2*(a^2+b^2)^-2*(b*c+-1*a*d)^-2*(2*b^4*(-4*A*d+3*B*c)+-8*C*d*a^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*d^2*(A+-11C)+-8*B*c*d^3+-2*B*d*c^3)+6*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C)))+b*d^-3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^(1/2)*(c^2+d^2)^-2*(b*(d^4*(C+4A)+5*C*c^4+-6*B*c*d^3+-2*B*d*c^3+10*C*c^2*d^2)+2*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C))))
@test integrate((a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^3//2*(c+im*d)^-5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^3//2*(c+-1*im*d)^-5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+2*C*b^3//2*d^-5//2*f^-1*arctanh(b^-1//2*d^(1/2)*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*d^-2*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(2*b*(A*d^4+C*c^4+-1*c^2*d^2*(A+-3C)+-2*B*c*d^3)+2*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C)))+-1//3*d^-1*f^-1*(a+b*tan(e+f*x))^3//2*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d))
@test integrate((a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(-1*f^-1*(a+im*b)^(1/2)*(c+im*d)^-5//2*(B+-1*im*(A+-1C))*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^(1/2)*(c+-1*im*d)^-5//2*(B+im*A+-1*im*C)*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+-1//3*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+1//3*d^-1*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(b*c+-1*a*d)^-1*(2*b*(A*d^4+C*c^4+-1*c^2*d^2*(-7C+5A)+-4*B*c*d^3+2*B*d*c^3)+6*a*d^2*(-1*B*(c^2+-1*d^2)+2*c*d*(A+-1C))))
@test integrate((a+b*tan(e+f*x))^-1//2*(c+d*tan(e+f*x))^-5//2*(A+B*tan(e+f*x)+C*tan(e+f*x)^2), x) == :(f^-1*(a+im*b)^-1//2*(c+im*d)^-5//2*(-1B+im*A+-1*im*C)*arctanh((a+im*b)^-1//2*(a+b*tan(e+f*x))^(1/2)*(c+im*d)^(1/2)*(c+d*tan(e+f*x))^-1//2)+-1*f^-1*(a+-1*im*b)^-1//2*(c+-1*im*d)^-5//2*(B+im*(A+-1C))*arctanh((a+b*tan(e+f*x))^(1/2)*(a+-1*im*b)^-1//2*(c+d*tan(e+f*x))^-1//2*(c+-1*im*d)^(1/2))+f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-3//2*(c^2+d^2)^-1*(-3*a*d+3*b*c)^-1*(2*A*d^2+2*C*c^2+-2*B*c*d)+1//3*f^-1*(a+b*tan(e+f*x))^(1/2)*(c+d*tan(e+f*x))^-1//2*(c^2+d^2)^-2*(b*c+-1*a*d)^-2*(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*d*c^2)+3*a*b^2*(-1*B*(c^4+2*d^4+c^2*d^2)+2*C*c*d^3)+3*a^3*d^2*(B*(c^2+-1*d^2)+2*C*c*d)))

max_stars_repo_path: test/4 Trig functions/4.3 Tangent/4.3.4.2 (a+b tan)^m (c+d tan)^n (A+B tan+C tan^2).jl


text:
# NOTE:
# emulation always execute the program directly
# we will use another entrance for optimized program
# emulation

# NOTE:
# in principal we can do hardware specific optimization here
# since we know which hardware we will run the function on inside
# execute
#
# However, we may need Keno's work on custom optimization pass
# if we want to compile things back to Julia (typed) IR.
#
# we are fine if our target machine runs something else (e.g QASM)
# in this case, instead of using `@generated` function, we can just
# define a normal execute function can link a compiled binary or
# some foreign function call.
@generated function execute(::typeof(Semantic.main), ::AbstractRegister, spec::RoutineSpec)
    return codegen_ast(Semantic.main, spec)
end

@generated function execute(
    ::typeof(Semantic.gate),
    ::AbstractRegister,
    spec::RoutineSpec,
    ::Locations,
)
    return codegen_ast(Semantic.gate, spec)
end

@generated function execute(
    ::typeof(Semantic.ctrl),
    ::AbstractRegister,
    spec::RoutineSpec,
    ::Locations,
    ::CtrlLocations,
)
    return codegen_ast(Semantic.ctrl, spec)
end

function execute(::Function, ::AbstractRegister, args...)
    return
end

# this doesn't work yet, need to eval a typed IR
# @generated function optimized_execute(spec::RoutineSpec, ::EchoReg, loc::Locations)
#     ci = create_codeinfo(Semantic.gate, spec)
#     ir = YaoIR(r, Semantic.gate, spec, loc)
#     ir = optimize(ir)
#     return replace_with_execute(ir.ci)
# end

# @generated function optimized_execute(spec::RoutineSpec, r::EchoReg, loc::Locations, ctrl::CtrlLocations)
#     return codegen_optimized_ast(Semantic.ctrl, spec)
# end

# function codegen_optimized_ast(f, S::Type{<:RoutineSpec})
#     ci = create_codeinfo(f, S)
#     ci = optimize(f, ci)
#     return replace_with_execute(ci)
# end

function codegen_ast(f, S::Type{<:RoutineSpec})
    ci = create_codeinfo(f, S)
    ci = replace_with_execute(ci)
    return ci
end

function replace_with_execute(ci::CodeInfo)
    # NOTE: we won't unpack variables here, so nargs doesn't matter
    new = NewCodeInfo(ci, 0)
    insert_slot!(new, 2, gensym(:stub))
    insert_slot!(new, 3, gensym(:register))
    register = SlotNumber(3)

    for (v, stmt) in enumerate(ci.code)
        stmt = update_slots(stmt, new.slotmap)
        codeloc = new.src.codelocs[v]
        if is_quantum_statement(stmt)
            t = quantum_stmt_type(stmt)
            if t === :measure
                cvar, measure = _extract_measure(stmt)
                e = Expr(
                    :call,
                    GlobalRef(YaoCompiler, :execute),
                    GlobalRef(Semantic, t),
                    register,
                    measure.args[2:end]...,
                )
                if !isnothing(cvar)
                    e = Expr(:(=), cvar, e)
                end
                push_stmt!(new, e, codeloc)
            else
                push_stmt!(
                    new,
                    Expr(
                        :call,
                        GlobalRef(YaoCompiler, :execute),
                        GlobalRef(Semantic, t),
                        register,
                        stmt.args[2:end]...,
                    ),
                    codeloc,
                )
            end
        else
            push_stmt!(new, stmt, codeloc)
        end
    end

    return finish(new)
end

ext: jl