\(\int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx\) [563]

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

Optimal result

Integrand size = 21, antiderivative size = 61 \[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\frac {2 A E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+\frac {2 B \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )}{3 d}+\frac {2 B \sqrt {\cos (c+d x)} \sin (c+d x)}{3 d} \] Output:

2*A*EllipticE(sin(1/2*d*x+1/2*c),2^(1/2))/d+2/3*B*InverseJacobiAM(1/2*d*x+ 
1/2*c,2^(1/2))/d+2/3*B*cos(d*x+c)^(1/2)*sin(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.17 (sec) , antiderivative size = 53, normalized size of antiderivative = 0.87 \[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\frac {2 \left (3 A E\left (\left .\frac {1}{2} (c+d x)\right |2\right )+B \left (\operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )+\sqrt {\cos (c+d x)} \sin (c+d x)\right )\right )}{3 d} \] Input:

Integrate[Sqrt[Cos[c + d*x]]*(A + B*Cos[c + d*x]),x]
 

Output:

(2*(3*A*EllipticE[(c + d*x)/2, 2] + B*(EllipticF[(c + d*x)/2, 2] + Sqrt[Co 
s[c + d*x]]*Sin[c + d*x])))/(3*d)
 

Rubi [A] (verified)

Time = 0.36 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.02, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 3227, 3042, 3115, 3042, 3119, 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 \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )} \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx\)

\(\Big \downarrow \) 3227

\(\displaystyle A \int \sqrt {\cos (c+d x)}dx+B \int \cos ^{\frac {3}{2}}(c+d x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle A \int \sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}dx+B \int \sin \left (c+d x+\frac {\pi }{2}\right )^{3/2}dx\)

\(\Big \downarrow \) 3115

\(\displaystyle A \int \sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}dx+B \left (\frac {1}{3} \int \frac {1}{\sqrt {\cos (c+d x)}}dx+\frac {2 \sin (c+d x) \sqrt {\cos (c+d x)}}{3 d}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle A \int \sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}dx+B \left (\frac {1}{3} \int \frac {1}{\sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}}dx+\frac {2 \sin (c+d x) \sqrt {\cos (c+d x)}}{3 d}\right )\)

\(\Big \downarrow \) 3119

\(\displaystyle B \left (\frac {1}{3} \int \frac {1}{\sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}}dx+\frac {2 \sin (c+d x) \sqrt {\cos (c+d x)}}{3 d}\right )+\frac {2 A E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}\)

\(\Big \downarrow \) 3120

\(\displaystyle \frac {2 A E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+B \left (\frac {2 \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )}{3 d}+\frac {2 \sin (c+d x) \sqrt {\cos (c+d x)}}{3 d}\right )\)

Input:

Int[Sqrt[Cos[c + d*x]]*(A + B*Cos[c + d*x]),x]
 

Output:

(2*A*EllipticE[(c + d*x)/2, 2])/d + B*((2*EllipticF[(c + d*x)/2, 2])/(3*d) 
 + (2*Sqrt[Cos[c + d*x]]*Sin[c + d*x])/(3*d))
 

Defintions of rubi rules used

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

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

rule 3119
Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticE[(1/2)* 
(c - Pi/2 + d*x), 2], x] /; FreeQ[{c, d}, 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 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 
Maple [B] (verified)

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

Time = 5.71 (sec) , antiderivative size = 229, normalized size of antiderivative = 3.75

method result size
default \(\frac {2 \sqrt {\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 (-4 B \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+3 A \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 {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )+2 B \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-B \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 {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}\) \(229\)
parts \(\frac {2 A \sqrt {\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}}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}-\frac {2 B \sqrt {\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 (4 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} \cos \left (\frac {d x}{2}+\frac {c}{2}\right )-2 \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 {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}\) \(314\)

Input:

int(cos(d*x+c)^(1/2)*(A+B*cos(d*x+c)),x,method=_RETURNVERBOSE)
 

Output:

2/3*((2*cos(1/2*d*x+1/2*c)^2-1)*sin(1/2*d*x+1/2*c)^2)^(1/2)*(-4*B*cos(1/2* 
d*x+1/2*c)*sin(1/2*d*x+1/2*c)^4+3*A*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/ 
2*d*x+1/2*c)^2-1)^(1/2)*EllipticE(cos(1/2*d*x+1/2*c),2^(1/2))+2*B*cos(1/2* 
d*x+1/2*c)*sin(1/2*d*x+1/2*c)^2-B*(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)))/(-2*sin(1/2*d 
*x+1/2*c)^4+sin(1/2*d*x+1/2*c)^2)^(1/2)/sin(1/2*d*x+1/2*c)/(2*cos(1/2*d*x+ 
1/2*c)^2-1)^(1/2)/d
 

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.09 (sec) , antiderivative size = 125, normalized size of antiderivative = 2.05 \[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\frac {2 \, B \sqrt {\cos \left (d x + c\right )} \sin \left (d x + c\right ) - i \, \sqrt {2} B {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right ) + i \, \sqrt {2} B {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right ) + 3 i \, \sqrt {2} A {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) - 3 i \, \sqrt {2} A {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right )}{3 \, d} \] Input:

integrate(cos(d*x+c)^(1/2)*(A+B*cos(d*x+c)),x, algorithm="fricas")
 

Output:

1/3*(2*B*sqrt(cos(d*x + c))*sin(d*x + c) - I*sqrt(2)*B*weierstrassPInverse 
(-4, 0, cos(d*x + c) + I*sin(d*x + c)) + I*sqrt(2)*B*weierstrassPInverse(- 
4, 0, cos(d*x + c) - I*sin(d*x + c)) + 3*I*sqrt(2)*A*weierstrassZeta(-4, 0 
, weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x + c))) - 3*I*sqrt(2) 
*A*weierstrassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) - I*sin( 
d*x + c))))/d
 

Sympy [F]

\[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\int \left (A + B \cos {\left (c + d x \right )}\right ) \sqrt {\cos {\left (c + d x \right )}}\, dx \] Input:

integrate(cos(d*x+c)**(1/2)*(A+B*cos(d*x+c)),x)
 

Output:

Integral((A + B*cos(c + d*x))*sqrt(cos(c + d*x)), x)
 

Maxima [F]

\[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\int { {\left (B \cos \left (d x + c\right ) + A\right )} \sqrt {\cos \left (d x + c\right )} \,d x } \] Input:

integrate(cos(d*x+c)^(1/2)*(A+B*cos(d*x+c)),x, algorithm="maxima")
 

Output:

integrate((B*cos(d*x + c) + A)*sqrt(cos(d*x + c)), x)
 

Giac [F]

\[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\int { {\left (B \cos \left (d x + c\right ) + A\right )} \sqrt {\cos \left (d x + c\right )} \,d x } \] Input:

integrate(cos(d*x+c)^(1/2)*(A+B*cos(d*x+c)),x, algorithm="giac")
 

Output:

integrate((B*cos(d*x + c) + A)*sqrt(cos(d*x + c)), x)
 

Mupad [B] (verification not implemented)

Time = 42.33 (sec) , antiderivative size = 53, normalized size of antiderivative = 0.87 \[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\frac {2\,A\,\mathrm {E}\left (\frac {c}{2}+\frac {d\,x}{2}\middle |2\right )}{d}+\frac {2\,B\,\mathrm {F}\left (\frac {c}{2}+\frac {d\,x}{2}\middle |2\right )}{3\,d}+\frac {2\,B\,\sqrt {\cos \left (c+d\,x\right )}\,\sin \left (c+d\,x\right )}{3\,d} \] Input:

int(cos(c + d*x)^(1/2)*(A + B*cos(c + d*x)),x)
 

Output:

(2*A*ellipticE(c/2 + (d*x)/2, 2))/d + (2*B*ellipticF(c/2 + (d*x)/2, 2))/(3 
*d) + (2*B*cos(c + d*x)^(1/2)*sin(c + d*x))/(3*d)
 

Reduce [F]

\[ \int \sqrt {\cos (c+d x)} (A+B \cos (c+d x)) \, dx=\left (\int \sqrt {\cos \left (d x +c \right )}d x \right ) a +\left (\int \sqrt {\cos \left (d x +c \right )}\, \cos \left (d x +c \right )d x \right ) b \] Input:

int(cos(d*x+c)^(1/2)*(A+B*cos(d*x+c)),x)
 

Output:

int(sqrt(cos(c + d*x)),x)*a + int(sqrt(cos(c + d*x))*cos(c + d*x),x)*b