\(\int \sqrt {a \cos (c+d x)+b \sin (c+d x)} \, dx\) [235]

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

Optimal result

Integrand size = 21, antiderivative size = 75 \[ \int \sqrt {a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {2 E\left (\left .\frac {1}{2} \left (c+d x-\tan ^{-1}(a,b)\right )\right |2\right ) \sqrt {a \cos (c+d x)+b \sin (c+d x)}}{d \sqrt {\frac {a \cos (c+d x)+b \sin (c+d x)}{\sqrt {a^2+b^2}}}} \]

[Out]

2*(cos(1/2*c+1/2*d*x-1/2*arctan(a,b))^2)^(1/2)/cos(1/2*c+1/2*d*x-1/2*arctan(a,b))*EllipticE(sin(1/2*c+1/2*d*x-
1/2*arctan(a,b)),2^(1/2))*(a*cos(d*x+c)+b*sin(d*x+c))^(1/2)/d/((a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)^(1/2))^(1
/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3157, 2719} \[ \int \sqrt {a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {2 \sqrt {a \cos (c+d x)+b \sin (c+d x)} E\left (\left .\frac {1}{2} \left (c+d x-\tan ^{-1}(a,b)\right )\right |2\right )}{d \sqrt {\frac {a \cos (c+d x)+b \sin (c+d x)}{\sqrt {a^2+b^2}}}} \]

[In]

Int[Sqrt[a*Cos[c + d*x] + b*Sin[c + d*x]],x]

[Out]

(2*EllipticE[(c + d*x - ArcTan[a, b])/2, 2]*Sqrt[a*Cos[c + d*x] + b*Sin[c + d*x]])/(d*Sqrt[(a*Cos[c + d*x] + b
*Sin[c + d*x])/Sqrt[a^2 + b^2]])

Rule 2719

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 3157

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[(a*Cos[c + d*x] +
b*Sin[c + d*x])^n/((a*Cos[c + d*x] + b*Sin[c + d*x])/Sqrt[a^2 + b^2])^n, Int[Cos[c + d*x - ArcTan[a, b]]^n, x]
, x] /; FreeQ[{a, b, c, d, n}, x] &&  !(GeQ[n, 1] || LeQ[n, -1]) &&  !(GtQ[a^2 + b^2, 0] || EqQ[a^2 + b^2, 0])

Rubi steps \begin{align*} \text {integral}& = \frac {\sqrt {a \cos (c+d x)+b \sin (c+d x)} \int \sqrt {\cos \left (c+d x-\tan ^{-1}(a,b)\right )} \, dx}{\sqrt {\frac {a \cos (c+d x)+b \sin (c+d x)}{\sqrt {a^2+b^2}}}} \\ & = \frac {2 E\left (\left .\frac {1}{2} \left (c+d x-\tan ^{-1}(a,b)\right )\right |2\right ) \sqrt {a \cos (c+d x)+b \sin (c+d x)}}{d \sqrt {\frac {a \cos (c+d x)+b \sin (c+d x)}{\sqrt {a^2+b^2}}}} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 4 in optimal.

Time = 0.88 (sec) , antiderivative size = 268, normalized size of antiderivative = 3.57 \[ \int \sqrt {a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {\cos \left (c+d x-\arctan \left (\frac {b}{a}\right )\right ) \left (-b \left (a^2+b^2\right ) \, _2F_1\left (-\frac {1}{2},-\frac {1}{4};\frac {3}{4};\cos ^2\left (c+d x-\arctan \left (\frac {b}{a}\right )\right )\right ) \sin \left (c+d x-\arctan \left (\frac {b}{a}\right )\right )+\sqrt {\sin ^2\left (c+d x-\arctan \left (\frac {b}{a}\right )\right )} \left (-2 a \left (a^2+b^2\right ) \cos \left (c+d x-\arctan \left (\frac {b}{a}\right )\right )+2 a^2 \sqrt {1+\frac {b^2}{a^2}} \sqrt {a \sqrt {1+\frac {b^2}{a^2}} \cos \left (c+d x-\arctan \left (\frac {b}{a}\right )\right )} \sqrt {a \cos (c+d x)+b \sin (c+d x)}+b \left (a^2+b^2\right ) \sin \left (c+d x-\arctan \left (\frac {b}{a}\right )\right )\right )\right )}{b d \left (a \sqrt {1+\frac {b^2}{a^2}} \cos \left (c+d x-\arctan \left (\frac {b}{a}\right )\right )\right )^{3/2} \sqrt {\sin ^2\left (c+d x-\arctan \left (\frac {b}{a}\right )\right )}} \]

[In]

Integrate[Sqrt[a*Cos[c + d*x] + b*Sin[c + d*x]],x]

[Out]

(Cos[c + d*x - ArcTan[b/a]]*(-(b*(a^2 + b^2)*HypergeometricPFQ[{-1/2, -1/4}, {3/4}, Cos[c + d*x - ArcTan[b/a]]
^2]*Sin[c + d*x - ArcTan[b/a]]) + Sqrt[Sin[c + d*x - ArcTan[b/a]]^2]*(-2*a*(a^2 + b^2)*Cos[c + d*x - ArcTan[b/
a]] + 2*a^2*Sqrt[1 + b^2/a^2]*Sqrt[a*Sqrt[1 + b^2/a^2]*Cos[c + d*x - ArcTan[b/a]]]*Sqrt[a*Cos[c + d*x] + b*Sin
[c + d*x]] + b*(a^2 + b^2)*Sin[c + d*x - ArcTan[b/a]])))/(b*d*(a*Sqrt[1 + b^2/a^2]*Cos[c + d*x - ArcTan[b/a]])
^(3/2)*Sqrt[Sin[c + d*x - ArcTan[b/a]]^2])

Maple [A] (verified)

Time = 3.51 (sec) , antiderivative size = 163, normalized size of antiderivative = 2.17

method result size
default \(-\frac {\sqrt {a^{2}+b^{2}}\, \sqrt {-\sin \left (d x +c -\arctan \left (-a , b\right )\right )+1}\, \sqrt {2 \sin \left (d x +c -\arctan \left (-a , b\right )\right )+2}\, \sqrt {\sin \left (d x +c -\arctan \left (-a , b\right )\right )}\, \left (2 \operatorname {EllipticE}\left (\sqrt {-\sin \left (d x +c -\arctan \left (-a , b\right )\right )+1}, \frac {\sqrt {2}}{2}\right )-\operatorname {EllipticF}\left (\sqrt {-\sin \left (d x +c -\arctan \left (-a , b\right )\right )+1}, \frac {\sqrt {2}}{2}\right )\right )}{\cos \left (d x +c -\arctan \left (-a , b\right )\right ) \sqrt {\sin \left (d x +c -\arctan \left (-a , b\right )\right ) \sqrt {a^{2}+b^{2}}}\, d}\) \(163\)
risch \(\text {Expression too large to display}\) \(1175\)

[In]

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

[Out]

-(a^2+b^2)^(1/2)*(-sin(d*x+c-arctan(-a,b))+1)^(1/2)*(2*sin(d*x+c-arctan(-a,b))+2)^(1/2)*sin(d*x+c-arctan(-a,b)
)^(1/2)*(2*EllipticE((-sin(d*x+c-arctan(-a,b))+1)^(1/2),1/2*2^(1/2))-EllipticF((-sin(d*x+c-arctan(-a,b))+1)^(1
/2),1/2*2^(1/2)))/cos(d*x+c-arctan(-a,b))/(sin(d*x+c-arctan(-a,b))*(a^2+b^2)^(1/2))^(1/2)/d

Fricas [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.09 (sec) , antiderivative size = 163, normalized size of antiderivative = 2.17 \[ \int \sqrt {a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {i \, \sqrt {2} \sqrt {a - i \, b} {\rm weierstrassZeta}\left (-\frac {4 \, {\left (a^{2} + 2 i \, a b - b^{2}\right )}}{a^{2} + b^{2}}, 0, {\rm weierstrassPInverse}\left (-\frac {4 \, {\left (a^{2} + 2 i \, a b - b^{2}\right )}}{a^{2} + b^{2}}, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) - i \, \sqrt {2} \sqrt {a + i \, b} {\rm weierstrassZeta}\left (-\frac {4 \, {\left (a^{2} - 2 i \, a b - b^{2}\right )}}{a^{2} + b^{2}}, 0, {\rm weierstrassPInverse}\left (-\frac {4 \, {\left (a^{2} - 2 i \, a b - b^{2}\right )}}{a^{2} + b^{2}}, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right )}{d} \]

[In]

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

[Out]

(I*sqrt(2)*sqrt(a - I*b)*weierstrassZeta(-4*(a^2 + 2*I*a*b - b^2)/(a^2 + b^2), 0, weierstrassPInverse(-4*(a^2
+ 2*I*a*b - b^2)/(a^2 + b^2), 0, cos(d*x + c) + I*sin(d*x + c))) - I*sqrt(2)*sqrt(a + I*b)*weierstrassZeta(-4*
(a^2 - 2*I*a*b - b^2)/(a^2 + b^2), 0, weierstrassPInverse(-4*(a^2 - 2*I*a*b - b^2)/(a^2 + b^2), 0, cos(d*x + c
) - I*sin(d*x + c))))/d

Sympy [F]

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

[In]

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

[Out]

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

Maxima [F]

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

[In]

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

[Out]

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

Giac [F]

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

[In]

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

[Out]

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

Mupad [F(-1)]

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

[In]

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

[Out]

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