\(\int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx\) [310]

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

Optimal result

Integrand size = 25, antiderivative size = 79 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=-\frac {\sqrt {2} (A-B) \text {arctanh}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} f}-\frac {2 B \cos (e+f x)}{f \sqrt {a+a \sin (e+f x)}} \] Output:

-2^(1/2)*(A-B)*arctanh(1/2*a^(1/2)*cos(f*x+e)*2^(1/2)/(a+a*sin(f*x+e))^(1/ 
2))/a^(1/2)/f-2*B*cos(f*x+e)/f/(a+a*sin(f*x+e))^(1/2)
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.59 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.34 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=\frac {2 \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left ((1+i) (-1)^{3/4} (A-B) \text {arctanh}\left (\left (\frac {1}{2}+\frac {i}{2}\right ) (-1)^{3/4} \left (-1+\tan \left (\frac {1}{4} (e+f x)\right )\right )\right )+B \left (-\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{f \sqrt {a (1+\sin (e+f x))}} \] Input:

Integrate[(A + B*Sin[e + f*x])/Sqrt[a + a*Sin[e + f*x]],x]
 

Output:

(2*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])*((1 + I)*(-1)^(3/4)*(A - B)*ArcTa 
nh[(1/2 + I/2)*(-1)^(3/4)*(-1 + Tan[(e + f*x)/4])] + B*(-Cos[(e + f*x)/2] 
+ Sin[(e + f*x)/2])))/(f*Sqrt[a*(1 + Sin[e + f*x])])
 

Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3042, 3230, 3042, 3128, 219}

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 (e+f x)}{\sqrt {a \sin (e+f x)+a}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {A+B \sin (e+f x)}{\sqrt {a \sin (e+f x)+a}}dx\)

\(\Big \downarrow \) 3230

\(\displaystyle (A-B) \int \frac {1}{\sqrt {\sin (e+f x) a+a}}dx-\frac {2 B \cos (e+f x)}{f \sqrt {a \sin (e+f x)+a}}\)

\(\Big \downarrow \) 3042

\(\displaystyle (A-B) \int \frac {1}{\sqrt {\sin (e+f x) a+a}}dx-\frac {2 B \cos (e+f x)}{f \sqrt {a \sin (e+f x)+a}}\)

\(\Big \downarrow \) 3128

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

\(\Big \downarrow \) 219

\(\displaystyle -\frac {\sqrt {2} (A-B) \text {arctanh}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a \sin (e+f x)+a}}\right )}{\sqrt {a} f}-\frac {2 B \cos (e+f x)}{f \sqrt {a \sin (e+f x)+a}}\)

Input:

Int[(A + B*Sin[e + f*x])/Sqrt[a + a*Sin[e + f*x]],x]
 

Output:

-((Sqrt[2]*(A - B)*ArcTanh[(Sqrt[a]*Cos[e + f*x])/(Sqrt[2]*Sqrt[a + a*Sin[ 
e + f*x]])])/(Sqrt[a]*f)) - (2*B*Cos[e + f*x])/(f*Sqrt[a + a*Sin[e + f*x]] 
)
 

Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

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

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

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

Time = 0.68 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.62

method result size
default \(-\frac {\left (1+\sin \left (f x +e \right )\right ) \sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \left (\sqrt {a}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) A -\sqrt {a}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) B +2 B \sqrt {a -a \sin \left (f x +e \right )}\right )}{a \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) \(128\)
parts \(-\frac {A \left (1+\sin \left (f x +e \right )\right ) \sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{\sqrt {a}\, \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}+\frac {B \left (1+\sin \left (f x +e \right )\right ) \sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \left (\sqrt {a}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )-2 \sqrt {a -a \sin \left (f x +e \right )}\right )}{a \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) \(171\)
risch \(-\frac {\left (-2 i A +i B +B \,{\mathrm e}^{i \left (f x +e \right )}\right ) \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) \sqrt {2}\, {\mathrm e}^{-i \left (f x +e \right )}}{f \sqrt {-a \left (i {\mathrm e}^{2 i \left (f x +e \right )}-i-2 \,{\mathrm e}^{i \left (f x +e \right )}\right ) {\mathrm e}^{-i \left (f x +e \right )}}}-\frac {2 i \left (A -B \right ) \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) \left (a^{\frac {3}{2}}+\arctan \left (\frac {\sqrt {-i {\mathrm e}^{i \left (f x +e \right )} a}}{\sqrt {a}}\right ) a \sqrt {-i {\mathrm e}^{i \left (f x +e \right )} a}\right ) \sqrt {2}\, {\mathrm e}^{-i \left (f x +e \right )}}{f \,a^{\frac {3}{2}} \sqrt {-a \left (i {\mathrm e}^{2 i \left (f x +e \right )}-i-2 \,{\mathrm e}^{i \left (f x +e \right )}\right ) {\mathrm e}^{-i \left (f x +e \right )}}}\) \(222\)

Input:

int((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2),x,method=_RETURNVERBOSE)
 

Output:

-(1+sin(f*x+e))*(-a*(sin(f*x+e)-1))^(1/2)*(a^(1/2)*2^(1/2)*arctanh(1/2*(a- 
a*sin(f*x+e))^(1/2)*2^(1/2)/a^(1/2))*A-a^(1/2)*2^(1/2)*arctanh(1/2*(a-a*si 
n(f*x+e))^(1/2)*2^(1/2)/a^(1/2))*B+2*B*(a-a*sin(f*x+e))^(1/2))/a/cos(f*x+e 
)/(a+a*sin(f*x+e))^(1/2)/f
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 210 vs. \(2 (68) = 136\).

Time = 0.09 (sec) , antiderivative size = 210, normalized size of antiderivative = 2.66 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=-\frac {\frac {\sqrt {2} {\left ({\left (A - B\right )} a \cos \left (f x + e\right ) + {\left (A - B\right )} a \sin \left (f x + e\right ) + {\left (A - B\right )} a\right )} \log \left (-\frac {\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) - 2\right )} \sin \left (f x + e\right ) + \frac {2 \, \sqrt {2} \sqrt {a \sin \left (f x + e\right ) + a} {\left (\cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right )}}{\sqrt {a}} + 3 \, \cos \left (f x + e\right ) + 2}{\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) + 2\right )} \sin \left (f x + e\right ) - \cos \left (f x + e\right ) - 2}\right )}{\sqrt {a}} + 4 \, {\left (B \cos \left (f x + e\right ) - B \sin \left (f x + e\right ) + B\right )} \sqrt {a \sin \left (f x + e\right ) + a}}{2 \, {\left (a f \cos \left (f x + e\right ) + a f \sin \left (f x + e\right ) + a f\right )}} \] Input:

integrate((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2),x, algorithm="fricas")
 

Output:

-1/2*(sqrt(2)*((A - B)*a*cos(f*x + e) + (A - B)*a*sin(f*x + e) + (A - B)*a 
)*log(-(cos(f*x + e)^2 - (cos(f*x + e) - 2)*sin(f*x + e) + 2*sqrt(2)*sqrt( 
a*sin(f*x + e) + a)*(cos(f*x + e) - sin(f*x + e) + 1)/sqrt(a) + 3*cos(f*x 
+ e) + 2)/(cos(f*x + e)^2 - (cos(f*x + e) + 2)*sin(f*x + e) - cos(f*x + e) 
 - 2))/sqrt(a) + 4*(B*cos(f*x + e) - B*sin(f*x + e) + B)*sqrt(a*sin(f*x + 
e) + a))/(a*f*cos(f*x + e) + a*f*sin(f*x + e) + a*f)
 

Sympy [F]

\[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=\int \frac {A + B \sin {\left (e + f x \right )}}{\sqrt {a \left (\sin {\left (e + f x \right )} + 1\right )}}\, dx \] Input:

integrate((A+B*sin(f*x+e))/(a+a*sin(f*x+e))**(1/2),x)
 

Output:

Integral((A + B*sin(e + f*x))/sqrt(a*(sin(e + f*x) + 1)), x)
 

Maxima [F]

\[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=\int { \frac {B \sin \left (f x + e\right ) + A}{\sqrt {a \sin \left (f x + e\right ) + a}} \,d x } \] Input:

integrate((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2),x, algorithm="maxima")
 

Output:

integrate((B*sin(f*x + e) + A)/sqrt(a*sin(f*x + e) + a), x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=\text {Exception raised: TypeError} \] Input:

integrate((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2),x, algorithm="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:sym2poly/r2sym(const gen & e,const 
index_m & i,const vecteur & l) Error: Bad Argument Value
 

Mupad [B] (verification not implemented)

Time = 1.10 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.91 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=-\frac {A\,\mathrm {F}\left (\frac {\pi }{4}-\frac {e}{2}-\frac {f\,x}{2}\middle |1\right )\,\sqrt {\frac {2\,\left (a+a\,\sin \left (e+f\,x\right )\right )}{a}}}{f\,\sqrt {a+a\,\sin \left (e+f\,x\right )}}-\frac {B\,\left (4\,\mathrm {E}\left (\mathrm {asin}\left (\frac {\sqrt {2}\,\sqrt {1-\sin \left (e+f\,x\right )}}{2}\right )\middle |1\right )-2\,\mathrm {F}\left (\mathrm {asin}\left (\frac {\sqrt {2}\,\sqrt {1-\sin \left (e+f\,x\right )}}{2}\right )\middle |1\right )\right )\,\sqrt {{\cos \left (e+f\,x\right )}^2}\,\sqrt {\frac {a+a\,\sin \left (e+f\,x\right )}{2\,a}}}{f\,\cos \left (e+f\,x\right )\,\sqrt {a+a\,\sin \left (e+f\,x\right )}} \] Input:

int((A + B*sin(e + f*x))/(a + a*sin(e + f*x))^(1/2),x)
 

Output:

- (A*ellipticF(pi/4 - e/2 - (f*x)/2, 1)*((2*(a + a*sin(e + f*x)))/a)^(1/2) 
)/(f*(a + a*sin(e + f*x))^(1/2)) - (B*(4*ellipticE(asin((2^(1/2)*(1 - sin( 
e + f*x))^(1/2))/2), 1) - 2*ellipticF(asin((2^(1/2)*(1 - sin(e + f*x))^(1/ 
2))/2), 1))*(cos(e + f*x)^2)^(1/2)*((a + a*sin(e + f*x))/(2*a))^(1/2))/(f* 
cos(e + f*x)*(a + a*sin(e + f*x))^(1/2))
 

Reduce [F]

\[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx=\frac {\sqrt {a}\, \left (\left (\int \frac {\sqrt {\sin \left (f x +e \right )+1}}{\sin \left (f x +e \right )+1}d x \right ) a +\left (\int \frac {\sqrt {\sin \left (f x +e \right )+1}\, \sin \left (f x +e \right )}{\sin \left (f x +e \right )+1}d x \right ) b \right )}{a} \] Input:

int((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2),x)
 

Output:

(sqrt(a)*(int(sqrt(sin(e + f*x) + 1)/(sin(e + f*x) + 1),x)*a + int((sqrt(s 
in(e + f*x) + 1)*sin(e + f*x))/(sin(e + f*x) + 1),x)*b))/a