\(\int \frac {\csc ^2(e+f x)}{(a+b \sec ^2(e+f x))^2} \, dx\) [51]

Optimal result
Mathematica [C] (warning: unable to verify)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [A] (verification not implemented)
Giac [A] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 91 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {3 \sqrt {b} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 (a+b)^{5/2} f}-\frac {3 \cot (e+f x)}{2 (a+b)^2 f}+\frac {\cot (e+f x)}{2 (a+b) f \left (a+b+b \tan ^2(e+f x)\right )} \] Output:

-3/2*b^(1/2)*arctan(b^(1/2)*tan(f*x+e)/(a+b)^(1/2))/(a+b)^(5/2)/f-3/2*cot( 
f*x+e)/(a+b)^2/f+1/2*cot(f*x+e)/(a+b)/f/(a+b+b*tan(f*x+e)^2)
 

Mathematica [C] (warning: unable to verify)

Result contains complex when optimal does not.

Time = 2.25 (sec) , antiderivative size = 242, normalized size of antiderivative = 2.66 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\frac {(a+2 b+a \cos (2 (e+f x))) \sec ^4(e+f x) \left (\frac {3 b \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (a+2 b+a \cos (2 (e+f x))) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}+2 (a+2 b+a \cos (2 (e+f x))) \csc (e) \csc (e+f x) \sin (f x)+\frac {b ((a+2 b) \sin (2 e)-a \sin (2 f x))}{a (\cos (e)-\sin (e)) (\cos (e)+\sin (e))}\right )}{8 (a+b)^2 f \left (a+b \sec ^2(e+f x)\right )^2} \] Input:

Integrate[Csc[e + f*x]^2/(a + b*Sec[e + f*x]^2)^2,x]
 

Output:

((a + 2*b + a*Cos[2*(e + f*x)])*Sec[e + f*x]^4*((3*b*ArcTan[(Sec[f*x]*(Cos 
[2*e] - I*Sin[2*e])*(-((a + 2*b)*Sin[f*x]) + a*Sin[2*e + f*x]))/(2*Sqrt[a 
+ b]*Sqrt[b*(Cos[e] - I*Sin[e])^4])]*(a + 2*b + a*Cos[2*(e + f*x)])*(Cos[2 
*e] - I*Sin[2*e]))/(Sqrt[a + b]*Sqrt[b*(Cos[e] - I*Sin[e])^4]) + 2*(a + 2* 
b + a*Cos[2*(e + f*x)])*Csc[e]*Csc[e + f*x]*Sin[f*x] + (b*((a + 2*b)*Sin[2 
*e] - a*Sin[2*f*x]))/(a*(Cos[e] - Sin[e])*(Cos[e] + Sin[e]))))/(8*(a + b)^ 
2*f*(a + b*Sec[e + f*x]^2)^2)
 

Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.01, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3042, 4620, 253, 264, 218}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\sin (e+f x)^2 \left (a+b \sec (e+f x)^2\right )^2}dx\)

\(\Big \downarrow \) 4620

\(\displaystyle \frac {\int \frac {\cot ^2(e+f x)}{\left (b \tan ^2(e+f x)+a+b\right )^2}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 253

\(\displaystyle \frac {\frac {3 \int \frac {\cot ^2(e+f x)}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{2 (a+b)}+\frac {\cot (e+f x)}{2 (a+b) \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 264

\(\displaystyle \frac {\frac {3 \left (-\frac {b \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a+b}-\frac {\cot (e+f x)}{a+b}\right )}{2 (a+b)}+\frac {\cot (e+f x)}{2 (a+b) \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {3 \left (-\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{(a+b)^{3/2}}-\frac {\cot (e+f x)}{a+b}\right )}{2 (a+b)}+\frac {\cot (e+f x)}{2 (a+b) \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

Input:

Int[Csc[e + f*x]^2/(a + b*Sec[e + f*x]^2)^2,x]
 

Output:

((3*(-((Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a + b]])/(a + b)^(3/2)) 
 - Cot[e + f*x]/(a + b)))/(2*(a + b)) + Cot[e + f*x]/(2*(a + b)*(a + b + b 
*Tan[e + f*x]^2)))/f
 

Defintions of rubi rules used

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

rule 253
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(-(c*x 
)^(m + 1))*((a + b*x^2)^(p + 1)/(2*a*c*(p + 1))), x] + Simp[(m + 2*p + 3)/( 
2*a*(p + 1))   Int[(c*x)^m*(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, c, m 
}, x] && LtQ[p, -1] && IntBinomialQ[a, b, c, 2, m, p, x]
 

rule 264
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(c*x)^( 
m + 1)*((a + b*x^2)^(p + 1)/(a*c*(m + 1))), x] - Simp[b*((m + 2*p + 3)/(a*c 
^2*(m + 1)))   Int[(c*x)^(m + 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, p 
}, x] && LtQ[m, -1] && IntBinomialQ[a, b, c, 2, m, p, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4620
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*sin[(e_.) + (f_.)*(x_ 
)]^(m_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[ff^(m 
+ 1)/f   Subst[Int[x^m*(ExpandToSum[a + b*(1 + ff^2*x^2)^(n/2), x]^p/(1 + f 
f^2*x^2)^(m/2 + 1)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, 
 x] && IntegerQ[m/2] && IntegerQ[n/2]
 
Maple [A] (verified)

Time = 0.65 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.86

method result size
derivativedivides \(\frac {-\frac {1}{\left (a +b \right )^{2} \tan \left (f x +e \right )}-\frac {b \left (\frac {\tan \left (f x +e \right )}{2 a +2 b +2 b \tan \left (f x +e \right )^{2}}+\frac {3 \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}\right )}{\left (a +b \right )^{2}}}{f}\) \(78\)
default \(\frac {-\frac {1}{\left (a +b \right )^{2} \tan \left (f x +e \right )}-\frac {b \left (\frac {\tan \left (f x +e \right )}{2 a +2 b +2 b \tan \left (f x +e \right )^{2}}+\frac {3 \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}\right )}{\left (a +b \right )^{2}}}{f}\) \(78\)
risch \(-\frac {i \left (2 a^{2} {\mathrm e}^{4 i \left (f x +e \right )}+a b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+4 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}+8 a b \,{\mathrm e}^{2 i \left (f x +e \right )}-2 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+2 a^{2}-a b \right )}{a \left (a +b \right )^{2} f \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a \right ) \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}-\frac {3 \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{4 \left (a +b \right )^{3} f}+\frac {3 \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{4 \left (a +b \right )^{3} f}\) \(260\)

Input:

int(csc(f*x+e)^2/(a+b*sec(f*x+e)^2)^2,x,method=_RETURNVERBOSE)
 

Output:

1/f*(-1/(a+b)^2/tan(f*x+e)-1/(a+b)^2*b*(1/2*tan(f*x+e)/(a+b+b*tan(f*x+e)^2 
)+3/2/((a+b)*b)^(1/2)*arctan(b*tan(f*x+e)/((a+b)*b)^(1/2))))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 160 vs. \(2 (77) = 154\).

Time = 0.11 (sec) , antiderivative size = 407, normalized size of antiderivative = 4.47 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\left [-\frac {4 \, {\left (2 \, a - b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (a \cos \left (f x + e\right )^{2} + b\right )} \sqrt {-\frac {b}{a + b}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a^{2} + 3 \, a b + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{3} - {\left (a b + b^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt {-\frac {b}{a + b}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) \sin \left (f x + e\right ) + 12 \, b \cos \left (f x + e\right )}{8 \, {\left ({\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} f\right )} \sin \left (f x + e\right )}, -\frac {2 \, {\left (2 \, a - b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (a \cos \left (f x + e\right )^{2} + b\right )} \sqrt {\frac {b}{a + b}} \arctan \left (\frac {{\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt {\frac {b}{a + b}}}{2 \, b \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) \sin \left (f x + e\right ) + 6 \, b \cos \left (f x + e\right )}{4 \, {\left ({\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} f\right )} \sin \left (f x + e\right )}\right ] \] Input:

integrate(csc(f*x+e)^2/(a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")
 

Output:

[-1/8*(4*(2*a - b)*cos(f*x + e)^3 - 3*(a*cos(f*x + e)^2 + b)*sqrt(-b/(a + 
b))*log(((a^2 + 8*a*b + 8*b^2)*cos(f*x + e)^4 - 2*(3*a*b + 4*b^2)*cos(f*x 
+ e)^2 + 4*((a^2 + 3*a*b + 2*b^2)*cos(f*x + e)^3 - (a*b + b^2)*cos(f*x + e 
))*sqrt(-b/(a + b))*sin(f*x + e) + b^2)/(a^2*cos(f*x + e)^4 + 2*a*b*cos(f* 
x + e)^2 + b^2))*sin(f*x + e) + 12*b*cos(f*x + e))/(((a^3 + 2*a^2*b + a*b^ 
2)*f*cos(f*x + e)^2 + (a^2*b + 2*a*b^2 + b^3)*f)*sin(f*x + e)), -1/4*(2*(2 
*a - b)*cos(f*x + e)^3 - 3*(a*cos(f*x + e)^2 + b)*sqrt(b/(a + b))*arctan(1 
/2*((a + 2*b)*cos(f*x + e)^2 - b)*sqrt(b/(a + b))/(b*cos(f*x + e)*sin(f*x 
+ e)))*sin(f*x + e) + 6*b*cos(f*x + e))/(((a^3 + 2*a^2*b + a*b^2)*f*cos(f* 
x + e)^2 + (a^2*b + 2*a*b^2 + b^3)*f)*sin(f*x + e))]
 

Sympy [F]

\[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\int \frac {\csc ^{2}{\left (e + f x \right )}}{\left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2}}\, dx \] Input:

integrate(csc(f*x+e)**2/(a+b*sec(f*x+e)**2)**2,x)
 

Output:

Integral(csc(e + f*x)**2/(a + b*sec(e + f*x)**2)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.29 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {\frac {3 \, b \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{{\left (a^{2} + 2 \, a b + b^{2}\right )} \sqrt {{\left (a + b\right )} b}} + \frac {3 \, b \tan \left (f x + e\right )^{2} + 2 \, a + 2 \, b}{{\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{3} + {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} \tan \left (f x + e\right )}}{2 \, f} \] Input:

integrate(csc(f*x+e)^2/(a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")
 

Output:

-1/2*(3*b*arctan(b*tan(f*x + e)/sqrt((a + b)*b))/((a^2 + 2*a*b + b^2)*sqrt 
((a + b)*b)) + (3*b*tan(f*x + e)^2 + 2*a + 2*b)/((a^2*b + 2*a*b^2 + b^3)*t 
an(f*x + e)^3 + (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*tan(f*x + e)))/f
 

Giac [A] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.40 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {\frac {3 \, {\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )} b}{{\left (a^{2} + 2 \, a b + b^{2}\right )} \sqrt {a b + b^{2}}} + \frac {3 \, b \tan \left (f x + e\right )^{2} + 2 \, a + 2 \, b}{{\left (b \tan \left (f x + e\right )^{3} + a \tan \left (f x + e\right ) + b \tan \left (f x + e\right )\right )} {\left (a^{2} + 2 \, a b + b^{2}\right )}}}{2 \, f} \] Input:

integrate(csc(f*x+e)^2/(a+b*sec(f*x+e)^2)^2,x, algorithm="giac")
 

Output:

-1/2*(3*(pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt( 
a*b + b^2)))*b/((a^2 + 2*a*b + b^2)*sqrt(a*b + b^2)) + (3*b*tan(f*x + e)^2 
 + 2*a + 2*b)/((b*tan(f*x + e)^3 + a*tan(f*x + e) + b*tan(f*x + e))*(a^2 + 
 2*a*b + b^2)))/f
 

Mupad [B] (verification not implemented)

Time = 12.50 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.00 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {\frac {1}{a+b}+\frac {3\,b\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,{\left (a+b\right )}^2}}{f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^3+\left (a+b\right )\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {3\,\sqrt {b}\,\mathrm {atan}\left (\frac {\sqrt {b}\,\mathrm {tan}\left (e+f\,x\right )\,\left (a^2+2\,a\,b+b^2\right )}{{\left (a+b\right )}^{5/2}}\right )}{2\,f\,{\left (a+b\right )}^{5/2}} \] Input:

int(1/(sin(e + f*x)^2*(a + b/cos(e + f*x)^2)^2),x)
 

Output:

- (1/(a + b) + (3*b*tan(e + f*x)^2)/(2*(a + b)^2))/(f*(b*tan(e + f*x)^3 + 
tan(e + f*x)*(a + b))) - (3*b^(1/2)*atan((b^(1/2)*tan(e + f*x)*(2*a*b + a^ 
2 + b^2))/(a + b)^(5/2)))/(2*f*(a + b)^(5/2))
 

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 427, normalized size of antiderivative = 4.69 \[ \int \frac {\csc ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\frac {-3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right )^{3} a +3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right ) a +3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right ) b -3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right )^{3} a +3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right ) a +3 \sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\sqrt {a}}{\sqrt {b}}\right ) \sin \left (f x +e \right ) b -2 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a^{2}-\cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a b +\cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} b^{2}+2 \cos \left (f x +e \right ) a^{2}+4 \cos \left (f x +e \right ) a b +2 \cos \left (f x +e \right ) b^{2}}{2 \sin \left (f x +e \right ) f \left (\sin \left (f x +e \right )^{2} a^{4}+3 \sin \left (f x +e \right )^{2} a^{3} b +3 \sin \left (f x +e \right )^{2} a^{2} b^{2}+\sin \left (f x +e \right )^{2} a \,b^{3}-a^{4}-4 a^{3} b -6 a^{2} b^{2}-4 a \,b^{3}-b^{4}\right )} \] Input:

int(csc(f*x+e)^2/(a+b*sec(f*x+e)^2)^2,x)
 

Output:

( - 3*sqrt(b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e + f*x)/2) - sqrt(a))/sq 
rt(b))*sin(e + f*x)**3*a + 3*sqrt(b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e 
+ f*x)/2) - sqrt(a))/sqrt(b))*sin(e + f*x)*a + 3*sqrt(b)*sqrt(a + b)*atan( 
(sqrt(a + b)*tan((e + f*x)/2) - sqrt(a))/sqrt(b))*sin(e + f*x)*b - 3*sqrt( 
b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e + f*x)/2) + sqrt(a))/sqrt(b))*sin( 
e + f*x)**3*a + 3*sqrt(b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e + f*x)/2) + 
 sqrt(a))/sqrt(b))*sin(e + f*x)*a + 3*sqrt(b)*sqrt(a + b)*atan((sqrt(a + b 
)*tan((e + f*x)/2) + sqrt(a))/sqrt(b))*sin(e + f*x)*b - 2*cos(e + f*x)*sin 
(e + f*x)**2*a**2 - cos(e + f*x)*sin(e + f*x)**2*a*b + cos(e + f*x)*sin(e 
+ f*x)**2*b**2 + 2*cos(e + f*x)*a**2 + 4*cos(e + f*x)*a*b + 2*cos(e + f*x) 
*b**2)/(2*sin(e + f*x)*f*(sin(e + f*x)**2*a**4 + 3*sin(e + f*x)**2*a**3*b 
+ 3*sin(e + f*x)**2*a**2*b**2 + sin(e + f*x)**2*a*b**3 - a**4 - 4*a**3*b - 
 6*a**2*b**2 - 4*a*b**3 - b**4))