\(\int \frac {(a+b \sin (c+d x))^2}{\sqrt {e \cos (c+d x)}} \, dx\) [548]

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

Optimal result

Integrand size = 25, antiderivative size = 109 \[ \int \frac {(a+b \sin (c+d x))^2}{\sqrt {e \cos (c+d x)}} \, dx=-\frac {10 a b \sqrt {e \cos (c+d x)}}{3 d e}+\frac {2 \left (3 a^2+2 b^2\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )}{3 d \sqrt {e \cos (c+d x)}}-\frac {2 b \sqrt {e \cos (c+d x)} (a+b \sin (c+d x))}{3 d e} \] Output:

-10/3*a*b*(e*cos(d*x+c))^(1/2)/d/e+2/3*(3*a^2+2*b^2)*cos(d*x+c)^(1/2)*Inve 
rseJacobiAM(1/2*d*x+1/2*c,2^(1/2))/d/(e*cos(d*x+c))^(1/2)-2/3*b*(e*cos(d*x 
+c))^(1/2)*(a+b*sin(d*x+c))/d/e
 

Mathematica [A] (verified)

Time = 1.17 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.69 \[ \int \frac {(a+b \sin (c+d x))^2}{\sqrt {e \cos (c+d x)}} \, dx=\frac {2 \left (3 a^2+2 b^2\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )-2 b \cos (c+d x) (6 a+b \sin (c+d x))}{3 d \sqrt {e \cos (c+d x)}} \] Input:

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

Output:

(2*(3*a^2 + 2*b^2)*Sqrt[Cos[c + d*x]]*EllipticF[(c + d*x)/2, 2] - 2*b*Cos[ 
c + d*x]*(6*a + b*Sin[c + d*x]))/(3*d*Sqrt[e*Cos[c + d*x]])
 

Rubi [A] (verified)

Time = 0.54 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.01, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.360, Rules used = {3042, 3171, 27, 3042, 3148, 3042, 3121, 3042, 3120}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3171

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3148

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \left (\left (3 a^2+2 b^2\right ) \int \frac {1}{\sqrt {e \sin \left (c+d x+\frac {\pi }{2}\right )}}dx-\frac {10 a b \sqrt {e \cos (c+d x)}}{d e}\right )-\frac {2 b \sqrt {e \cos (c+d x)} (a+b \sin (c+d x))}{3 d e}\)

\(\Big \downarrow \) 3121

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \left (\frac {\left (3 a^2+2 b^2\right ) \sqrt {\cos (c+d x)} \int \frac {1}{\sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}}dx}{\sqrt {e \cos (c+d x)}}-\frac {10 a b \sqrt {e \cos (c+d x)}}{d e}\right )-\frac {2 b \sqrt {e \cos (c+d x)} (a+b \sin (c+d x))}{3 d e}\)

\(\Big \downarrow \) 3120

\(\displaystyle \frac {1}{3} \left (\frac {2 \left (3 a^2+2 b^2\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )}{d \sqrt {e \cos (c+d x)}}-\frac {10 a b \sqrt {e \cos (c+d x)}}{d e}\right )-\frac {2 b \sqrt {e \cos (c+d x)} (a+b \sin (c+d x))}{3 d e}\)

Input:

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

Output:

((-10*a*b*Sqrt[e*Cos[c + d*x]])/(d*e) + (2*(3*a^2 + 2*b^2)*Sqrt[Cos[c + d* 
x]]*EllipticF[(c + d*x)/2, 2])/(d*Sqrt[e*Cos[c + d*x]]))/3 - (2*b*Sqrt[e*C 
os[c + d*x]]*(a + b*Sin[c + d*x]))/(3*d*e)
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

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

rule 3120
Int[1/Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticF[(1/2 
)*(c - Pi/2 + d*x), 2], x] /; FreeQ[{c, d}, x]
 

rule 3121
Int[((b_)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*Sin[c + d*x]) 
^n/Sin[c + d*x]^n   Int[Sin[c + d*x]^n, x], x] /; FreeQ[{b, c, d}, x] && Lt 
Q[-1, n, 1] && IntegerQ[2*n]
 

rule 3148
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[(-b)*((g*Cos[e + f*x])^(p + 1)/(f*g*(p + 1))), x] + 
 Simp[a   Int[(g*Cos[e + f*x])^p, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && 
 (IntegerQ[2*p] || NeQ[a^2 - b^2, 0])
 

rule 3171
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_), x_Symbol] :> Simp[(-b)*(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + 
f*x])^(m - 1)/(f*g*(m + p))), x] + Simp[1/(m + p)   Int[(g*Cos[e + f*x])^p* 
(a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(m + p) + a*b*(2*m + p - 1) 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2, 0] 
 && GtQ[m, 1] && NeQ[m + p, 0] && (IntegersQ[2*m, 2*p] || IntegerQ[m])
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(209\) vs. \(2(96)=192\).

Time = 1.68 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.93

method result size
default \(\frac {\frac {8 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} b^{2}}{3}-\frac {4 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b^{2}}{3}-2 \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) a^{2}-\frac {4 \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) b^{2}}{3}+8 a b \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}-4 a b \sin \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} e +e}\, d}\) \(210\)
parts \(\frac {2 a^{2} \sqrt {\cos \left (d x +c \right )}\, \operatorname {InverseJacobiAM}\left (\frac {d x}{2}+\frac {c}{2}, \sqrt {2}\right )}{d \sqrt {e \cos \left (d x +c \right )}}+\frac {4 b^{2} \sqrt {e \left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \left (2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} \cos \left (\frac {d x}{2}+\frac {c}{2}\right )-\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \cos \left (\frac {d x}{2}+\frac {c}{2}\right )-\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )\right )}{3 \sqrt {-e \left (2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}-\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {e \left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}\, d}-\frac {4 a b \sqrt {e \cos \left (d x +c \right )}}{d e}\) \(250\)

Input:

int((a+b*sin(d*x+c))^2/(e*cos(d*x+c))^(1/2),x,method=_RETURNVERBOSE)
 

Output:

2/3/sin(1/2*d*x+1/2*c)/(-2*sin(1/2*d*x+1/2*c)^2*e+e)^(1/2)*(4*cos(1/2*d*x+ 
1/2*c)*sin(1/2*d*x+1/2*c)^4*b^2-2*cos(1/2*d*x+1/2*c)*sin(1/2*d*x+1/2*c)^2* 
b^2-3*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1)^(1/2)*Ellipt 
icF(cos(1/2*d*x+1/2*c),2^(1/2))*a^2-2*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin( 
1/2*d*x+1/2*c)^2-1)^(1/2)*EllipticF(cos(1/2*d*x+1/2*c),2^(1/2))*b^2+12*a*b 
*sin(1/2*d*x+1/2*c)^3-6*a*b*sin(1/2*d*x+1/2*c))/d
 

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.10 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.98 \[ \int \frac {(a+b \sin (c+d x))^2}{\sqrt {e \cos (c+d x)}} \, dx=-\frac {2 \, {\left (\sqrt {\frac {1}{2}} {\left (3 i \, a^{2} + 2 i \, b^{2}\right )} \sqrt {e} {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right ) + \sqrt {\frac {1}{2}} {\left (-3 i \, a^{2} - 2 i \, b^{2}\right )} \sqrt {e} {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right ) + {\left (b^{2} \sin \left (d x + c\right ) + 6 \, a b\right )} \sqrt {e \cos \left (d x + c\right )}\right )}}{3 \, d e} \] Input:

integrate((a+b*sin(d*x+c))^2/(e*cos(d*x+c))^(1/2),x, algorithm="fricas")
 

Output:

-2/3*(sqrt(1/2)*(3*I*a^2 + 2*I*b^2)*sqrt(e)*weierstrassPInverse(-4, 0, cos 
(d*x + c) + I*sin(d*x + c)) + sqrt(1/2)*(-3*I*a^2 - 2*I*b^2)*sqrt(e)*weier 
strassPInverse(-4, 0, cos(d*x + c) - I*sin(d*x + c)) + (b^2*sin(d*x + c) + 
 6*a*b)*sqrt(e*cos(d*x + c)))/(d*e)
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F]

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

integrate((a+b*sin(d*x+c))^2/(e*cos(d*x+c))^(1/2),x, algorithm="maxima")
                                                                                    
                                                                                    
 

Output:

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

Giac [F]

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

integrate((a+b*sin(d*x+c))^2/(e*cos(d*x+c))^(1/2),x, algorithm="giac")
 

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

(sqrt(e)*( - 4*sqrt(cos(c + d*x))*a*b + int(sqrt(cos(c + d*x))/cos(c + d*x 
),x)*a**2*d + int((sqrt(cos(c + d*x))*sin(c + d*x)**2)/cos(c + d*x),x)*b** 
2*d))/(d*e)