\(\int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx\) [934]

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

Optimal result

Integrand size = 37, antiderivative size = 141 \[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\frac {2 \arctan \left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {a+a \sin (e+f x)} \sqrt {c+d \sin (e+f x)}}\right )}{a^{3/2} \sqrt {d} f}-\frac {2 \sqrt {2} \text {arctanh}\left (\frac {\sqrt {a} \sqrt {c-d} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)} \sqrt {c+d \sin (e+f x)}}\right )}{a^{3/2} \sqrt {c-d} f} \] Output:

2*arctan(a^(1/2)*d^(1/2)*cos(f*x+e)/(a+a*sin(f*x+e))^(1/2)/(c+d*sin(f*x+e) 
)^(1/2))/a^(3/2)/d^(1/2)/f-2*2^(1/2)*arctanh(1/2*a^(1/2)*(c-d)^(1/2)*cos(f 
*x+e)*2^(1/2)/(a+a*sin(f*x+e))^(1/2)/(c+d*sin(f*x+e))^(1/2))/a^(3/2)/(c-d) 
^(1/2)/f
 

Mathematica [C] (warning: unable to verify)

Result contains complex when optimal does not.

Time = 17.61 (sec) , antiderivative size = 1338, normalized size of antiderivative = 9.49 \[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx =\text {Too large to display} \] Input:

Integrate[Cos[e + f*x]^2/((a + a*Sin[e + f*x])^(3/2)*Sqrt[c + d*Sin[e + f* 
x]]),x]
 

Output:

(((2*Sqrt[2]*Log[1 + Tan[(e + f*x)/2]])/Sqrt[c - d] + (I*Log[((2*I)*(I*c + 
 d + (1 + I)*Sqrt[2]*Sqrt[d]*Sqrt[(1 + Cos[e + f*x])^(-1)]*Sqrt[c + d*Sin[ 
e + f*x]] + (c + I*d)*Tan[(e + f*x)/2]))/(Sqrt[d]*(I + Tan[(e + f*x)/2]))] 
)/Sqrt[d] - (2*Sqrt[2]*Log[c - d + 2*Sqrt[c - d]*Sqrt[(1 + Cos[e + f*x])^( 
-1)]*Sqrt[c + d*Sin[e + f*x]] + (-c + d)*Tan[(e + f*x)/2]])/Sqrt[c - d] - 
(I*Log[(-2*(c + I*d + (1 + I)*Sqrt[2]*Sqrt[d]*Sqrt[(1 + Cos[e + f*x])^(-1) 
]*Sqrt[c + d*Sin[e + f*x]] + (I*c + d)*Tan[(e + f*x)/2]))/(Sqrt[d]*(-I + T 
an[(e + f*x)/2]))])/Sqrt[d])*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^3*(1/(( 
Cos[(e + f*x)/2] + Sin[(e + f*x)/2])*Sqrt[c + d*Sin[e + f*x]]) - Sin[e + f 
*x]/((Cos[(e + f*x)/2] + Sin[(e + f*x)/2])*Sqrt[c + d*Sin[e + f*x]])))/(f* 
(a*(1 + Sin[e + f*x]))^(3/2)*((Sqrt[2]*Sec[(e + f*x)/2]^2)/(Sqrt[c - d]*(1 
 + Tan[(e + f*x)/2])) - (2*Sqrt[2]*(((-c + d)*Sec[(e + f*x)/2]^2)/2 + (Sqr 
t[c - d]*d*Cos[e + f*x]*Sqrt[(1 + Cos[e + f*x])^(-1)])/Sqrt[c + d*Sin[e + 
f*x]] + Sqrt[c - d]*((1 + Cos[e + f*x])^(-1))^(3/2)*Sin[e + f*x]*Sqrt[c + 
d*Sin[e + f*x]]))/(Sqrt[c - d]*(c - d + 2*Sqrt[c - d]*Sqrt[(1 + Cos[e + f* 
x])^(-1)]*Sqrt[c + d*Sin[e + f*x]] + (-c + d)*Tan[(e + f*x)/2])) + ((I + T 
an[(e + f*x)/2])*(((2*I)*(((c + I*d)*Sec[(e + f*x)/2]^2)/2 + ((1 + I)*d^(3 
/2)*Cos[e + f*x]*Sqrt[(1 + Cos[e + f*x])^(-1)])/(Sqrt[2]*Sqrt[c + d*Sin[e 
+ f*x]]) + ((1 + I)*Sqrt[d]*((1 + Cos[e + f*x])^(-1))^(3/2)*Sin[e + f*x]*S 
qrt[c + d*Sin[e + f*x]])/Sqrt[2]))/(Sqrt[d]*(I + Tan[(e + f*x)/2])) - (...
 

Rubi [A] (verified)

Time = 1.06 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.03, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.243, Rules used = {3042, 3395, 3042, 3461, 3042, 3254, 218, 3261, 221}

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 {\cos ^2(e+f x)}{(a \sin (e+f x)+a)^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\cos (e+f x)^2}{(a \sin (e+f x)+a)^{3/2} \sqrt {c+d \sin (e+f x)}}dx\)

\(\Big \downarrow \) 3395

\(\displaystyle \frac {\int \frac {a-a \sin (e+f x)}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx}{a^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {a-a \sin (e+f x)}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx}{a^2}\)

\(\Big \downarrow \) 3461

\(\displaystyle \frac {2 a \int \frac {1}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx-\int \frac {\sqrt {\sin (e+f x) a+a}}{\sqrt {c+d \sin (e+f x)}}dx}{a^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 a \int \frac {1}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx-\int \frac {\sqrt {\sin (e+f x) a+a}}{\sqrt {c+d \sin (e+f x)}}dx}{a^2}\)

\(\Big \downarrow \) 3254

\(\displaystyle \frac {\frac {2 a \int \frac {1}{\frac {a^2 d \cos ^2(e+f x)}{(\sin (e+f x) a+a) (c+d \sin (e+f x))}+a}d\frac {a \cos (e+f x)}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}}{f}+2 a \int \frac {1}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx}{a^2}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {2 a \int \frac {1}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}dx+\frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {a \sin (e+f x)+a} \sqrt {c+d \sin (e+f x)}}\right )}{\sqrt {d} f}}{a^2}\)

\(\Big \downarrow \) 3261

\(\displaystyle \frac {\frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {a \sin (e+f x)+a} \sqrt {c+d \sin (e+f x)}}\right )}{\sqrt {d} f}-\frac {4 a^2 \int \frac {1}{2 a^2-\frac {a^3 (c-d) \cos ^2(e+f x)}{(\sin (e+f x) a+a) (c+d \sin (e+f x))}}d\frac {a \cos (e+f x)}{\sqrt {\sin (e+f x) a+a} \sqrt {c+d \sin (e+f x)}}}{f}}{a^2}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {a \sin (e+f x)+a} \sqrt {c+d \sin (e+f x)}}\right )}{\sqrt {d} f}-\frac {2 \sqrt {2} \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \sqrt {c-d} \cos (e+f x)}{\sqrt {2} \sqrt {a \sin (e+f x)+a} \sqrt {c+d \sin (e+f x)}}\right )}{f \sqrt {c-d}}}{a^2}\)

Input:

Int[Cos[e + f*x]^2/((a + a*Sin[e + f*x])^(3/2)*Sqrt[c + d*Sin[e + f*x]]),x 
]
 

Output:

((2*Sqrt[a]*ArcTan[(Sqrt[a]*Sqrt[d]*Cos[e + f*x])/(Sqrt[a + a*Sin[e + f*x] 
]*Sqrt[c + d*Sin[e + f*x]])])/(Sqrt[d]*f) - (2*Sqrt[2]*Sqrt[a]*ArcTanh[(Sq 
rt[a]*Sqrt[c - d]*Cos[e + f*x])/(Sqrt[2]*Sqrt[a + a*Sin[e + f*x]]*Sqrt[c + 
 d*Sin[e + f*x]])])/(Sqrt[c - d]*f))/a^2
 

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 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

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

rule 3254
Int[Sqrt[(a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]]/Sqrt[(c_.) + (d_.)*sin[(e_.) 
 + (f_.)*(x_)]], x_Symbol] :> Simp[-2*(b/f)   Subst[Int[1/(b + d*x^2), x], 
x, b*(Cos[e + f*x]/(Sqrt[a + b*Sin[e + f*x]]*Sqrt[c + d*Sin[e + f*x]]))], x 
] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] 
 && NeQ[c^2 - d^2, 0]
 

rule 3261
Int[1/(Sqrt[(a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]]*Sqrt[(c_.) + (d_.)*sin[(e 
_.) + (f_.)*(x_)]]), x_Symbol] :> Simp[-2*(a/f)   Subst[Int[1/(2*b^2 - (a*c 
 - b*d)*x^2), x], x, b*(Cos[e + f*x]/(Sqrt[a + b*Sin[e + f*x]]*Sqrt[c + d*S 
in[e + f*x]]))], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && 
 EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]
 

rule 3395
Int[cos[(e_.) + (f_.)*(x_)]^2*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*( 
(c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[1/b^2   Int[( 
a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*(a - b*Sin[e + f*x]), x] 
, x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && EqQ[a^2 - b^2, 0] && Integers 
Q[2*m, 2*n]
 

rule 3461
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(Sqrt[(a_) + (b_.)*sin[(e_.) + 
(f_.)*(x_)]]*Sqrt[(c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]]), x_Symbol] :> Sim 
p[(A*b - a*B)/b   Int[1/(Sqrt[a + b*Sin[e + f*x]]*Sqrt[c + d*Sin[e + f*x]]) 
, x], x] + Simp[B/b   Int[Sqrt[a + b*Sin[e + f*x]]/Sqrt[c + d*Sin[e + f*x]] 
, x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && EqQ[ 
a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]
 
Maple [F]

\[\int \frac {\cos \left (f x +e \right )^{2}}{\left (a +a \sin \left (f x +e \right )\right )^{\frac {3}{2}} \sqrt {c +d \sin \left (f x +e \right )}}d x\]

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 311 vs. \(2 (114) = 228\).

Time = 0.55 (sec) , antiderivative size = 2211, normalized size of antiderivative = 15.68 \[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\text {Too large to display} \] Input:

integrate(cos(f*x+e)^2/(a+a*sin(f*x+e))^(3/2)/(c+d*sin(f*x+e))^(1/2),x, al 
gorithm="fricas")
 

Output:

[1/4*(4*sqrt(2)*a*d*log(-((c - 3*d)*cos(f*x + e)^2 - 2*sqrt(2)*((c - d)*co 
s(f*x + e) - (c - d)*sin(f*x + e) + c - d)*sqrt(a*sin(f*x + e) + a)*sqrt(d 
*sin(f*x + e) + c)/sqrt(a*c - a*d) + (3*c - d)*cos(f*x + e) - ((c - 3*d)*c 
os(f*x + e) - 2*c - 2*d)*sin(f*x + e) + 2*c + 2*d)/(cos(f*x + e)^2 - (cos( 
f*x + e) + 2)*sin(f*x + e) - cos(f*x + e) - 2))/sqrt(a*c - a*d) - sqrt(-a* 
d)*log((128*a*d^4*cos(f*x + e)^5 + a*c^4 + 4*a*c^3*d + 6*a*c^2*d^2 + 4*a*c 
*d^3 + a*d^4 + 128*(2*a*c*d^3 - a*d^4)*cos(f*x + e)^4 - 32*(5*a*c^2*d^2 - 
14*a*c*d^3 + 13*a*d^4)*cos(f*x + e)^3 - 32*(a*c^3*d - 2*a*c^2*d^2 + 9*a*c* 
d^3 - 4*a*d^4)*cos(f*x + e)^2 - 8*(16*d^3*cos(f*x + e)^4 + 24*(c*d^2 - d^3 
)*cos(f*x + e)^3 - c^3 + 17*c^2*d - 59*c*d^2 + 51*d^3 - 2*(5*c^2*d - 26*c* 
d^2 + 33*d^3)*cos(f*x + e)^2 - (c^3 - 7*c^2*d + 31*c*d^2 - 25*d^3)*cos(f*x 
 + e) + (16*d^3*cos(f*x + e)^3 + c^3 - 17*c^2*d + 59*c*d^2 - 51*d^3 - 8*(3 
*c*d^2 - 5*d^3)*cos(f*x + e)^2 - 2*(5*c^2*d - 14*c*d^2 + 13*d^3)*cos(f*x + 
 e))*sin(f*x + e))*sqrt(-a*d)*sqrt(a*sin(f*x + e) + a)*sqrt(d*sin(f*x + e) 
 + c) + (a*c^4 - 28*a*c^3*d + 230*a*c^2*d^2 - 476*a*c*d^3 + 289*a*d^4)*cos 
(f*x + e) + (128*a*d^4*cos(f*x + e)^4 + a*c^4 + 4*a*c^3*d + 6*a*c^2*d^2 + 
4*a*c*d^3 + a*d^4 - 256*(a*c*d^3 - a*d^4)*cos(f*x + e)^3 - 32*(5*a*c^2*d^2 
 - 6*a*c*d^3 + 5*a*d^4)*cos(f*x + e)^2 + 32*(a*c^3*d - 7*a*c^2*d^2 + 15*a* 
c*d^3 - 9*a*d^4)*cos(f*x + e))*sin(f*x + e))/(cos(f*x + e) + sin(f*x + e) 
+ 1)))/(a^2*d*f), 1/2*(2*sqrt(2)*a*d*log(-((c - 3*d)*cos(f*x + e)^2 - 2...
 

Sympy [F]

\[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\int \frac {\cos ^{2}{\left (e + f x \right )}}{\left (a \left (\sin {\left (e + f x \right )} + 1\right )\right )^{\frac {3}{2}} \sqrt {c + d \sin {\left (e + f x \right )}}}\, dx \] Input:

integrate(cos(f*x+e)**2/(a+a*sin(f*x+e))**(3/2)/(c+d*sin(f*x+e))**(1/2),x)
 

Output:

Integral(cos(e + f*x)**2/((a*(sin(e + f*x) + 1))**(3/2)*sqrt(c + d*sin(e + 
 f*x))), x)
 

Maxima [F]

\[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\int { \frac {\cos \left (f x + e\right )^{2}}{{\left (a \sin \left (f x + e\right ) + a\right )}^{\frac {3}{2}} \sqrt {d \sin \left (f x + e\right ) + c}} \,d x } \] Input:

integrate(cos(f*x+e)^2/(a+a*sin(f*x+e))^(3/2)/(c+d*sin(f*x+e))^(1/2),x, al 
gorithm="maxima")
 

Output:

integrate(cos(f*x + e)^2/((a*sin(f*x + e) + a)^(3/2)*sqrt(d*sin(f*x + e) + 
 c)), x)
 

Giac [F(-1)]

Timed out. \[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\text {Timed out} \] Input:

integrate(cos(f*x+e)^2/(a+a*sin(f*x+e))^(3/2)/(c+d*sin(f*x+e))^(1/2),x, al 
gorithm="giac")
 

Output:

Timed out
 

Mupad [F(-1)]

Timed out. \[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\int \frac {{\cos \left (e+f\,x\right )}^2}{{\left (a+a\,\sin \left (e+f\,x\right )\right )}^{3/2}\,\sqrt {c+d\,\sin \left (e+f\,x\right )}} \,d x \] Input:

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

Output:

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

Reduce [F]

\[ \int \frac {\cos ^2(e+f x)}{(a+a \sin (e+f x))^{3/2} \sqrt {c+d \sin (e+f x)}} \, dx=\frac {\sqrt {a}\, \left (\int \frac {\sqrt {\sin \left (f x +e \right ) d +c}\, \sqrt {\sin \left (f x +e \right )+1}\, \cos \left (f x +e \right )^{2}}{\sin \left (f x +e \right )^{3} d +\sin \left (f x +e \right )^{2} c +2 \sin \left (f x +e \right )^{2} d +2 \sin \left (f x +e \right ) c +\sin \left (f x +e \right ) d +c}d x \right )}{a^{2}} \] Input:

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

Output:

(sqrt(a)*int((sqrt(sin(e + f*x)*d + c)*sqrt(sin(e + f*x) + 1)*cos(e + f*x) 
**2)/(sin(e + f*x)**3*d + sin(e + f*x)**2*c + 2*sin(e + f*x)**2*d + 2*sin( 
e + f*x)*c + sin(e + f*x)*d + c),x))/a**2