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

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

Optimal result

Integrand size = 37, antiderivative size = 136 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \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} (c-d) f}-\frac {2 (B c-A d) \text {arctanh}\left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {c+d} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} (c-d) \sqrt {d} \sqrt {c+d} f} \] 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)/(c-d)/f-2*(-A*d+B*c)*arctanh(a^(1/2)*d^(1/2)*cos(f*x+e)/(c+d)^ 
(1/2)/(a+a*sin(f*x+e))^(1/2))/a^(1/2)/(c-d)/d^(1/2)/(c+d)^(1/2)/f
 

Mathematica [C] (warning: unable to verify)

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

Time = 5.67 (sec) , antiderivative size = 619, normalized size of antiderivative = 4.55 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \sin (e+f x))} \, dx=\frac {(-1)^{3/4} \left ((4+4 i) (A-B) \sqrt {d} \sqrt {c+d} \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 )+\sqrt [4]{-1} (B c-A d) \text {RootSum}\left [c+4 d \text {$\#$1}+2 c \text {$\#$1}^2-4 d \text {$\#$1}^3+c \text {$\#$1}^4\&,\frac {-d \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right )+\sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right )-c \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}+2 \sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}+3 d \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^2-\sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^2-c \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^3}{-d-c \text {$\#$1}+3 d \text {$\#$1}^2-c \text {$\#$1}^3}\&\right ]-\sqrt [4]{-1} (B c-A d) \text {RootSum}\left [c+4 d \text {$\#$1}+2 c \text {$\#$1}^2-4 d \text {$\#$1}^3+c \text {$\#$1}^4\&,\frac {-d \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right )-\sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right )-c \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}-2 \sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}+3 d \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^2+\sqrt {d} \sqrt {c+d} \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^2-c \log \left (-\text {$\#$1}+\tan \left (\frac {1}{4} (e+f x)\right )\right ) \text {$\#$1}^3}{-d-c \text {$\#$1}+3 d \text {$\#$1}^2-c \text {$\#$1}^3}\&\right ]\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 (c-d) \sqrt {d} \sqrt {c+d} f \sqrt {a (1+\sin (e+f x))}} \] Input:

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

Output:

((-1)^(3/4)*((4 + 4*I)*(A - B)*Sqrt[d]*Sqrt[c + d]*ArcTanh[(1/2 + I/2)*(-1 
)^(3/4)*(-1 + Tan[(e + f*x)/4])] + (-1)^(1/4)*(B*c - A*d)*RootSum[c + 4*d* 
#1 + 2*c*#1^2 - 4*d*#1^3 + c*#1^4 & , (-(d*Log[-#1 + Tan[(e + f*x)/4]]) + 
Sqrt[d]*Sqrt[c + d]*Log[-#1 + Tan[(e + f*x)/4]] - c*Log[-#1 + Tan[(e + f*x 
)/4]]*#1 + 2*Sqrt[d]*Sqrt[c + d]*Log[-#1 + Tan[(e + f*x)/4]]*#1 + 3*d*Log[ 
-#1 + Tan[(e + f*x)/4]]*#1^2 - Sqrt[d]*Sqrt[c + d]*Log[-#1 + Tan[(e + f*x) 
/4]]*#1^2 - c*Log[-#1 + Tan[(e + f*x)/4]]*#1^3)/(-d - c*#1 + 3*d*#1^2 - c* 
#1^3) & ] - (-1)^(1/4)*(B*c - A*d)*RootSum[c + 4*d*#1 + 2*c*#1^2 - 4*d*#1^ 
3 + c*#1^4 & , (-(d*Log[-#1 + Tan[(e + f*x)/4]]) - Sqrt[d]*Sqrt[c + d]*Log 
[-#1 + Tan[(e + f*x)/4]] - c*Log[-#1 + Tan[(e + f*x)/4]]*#1 - 2*Sqrt[d]*Sq 
rt[c + d]*Log[-#1 + Tan[(e + f*x)/4]]*#1 + 3*d*Log[-#1 + Tan[(e + f*x)/4]] 
*#1^2 + Sqrt[d]*Sqrt[c + d]*Log[-#1 + Tan[(e + f*x)/4]]*#1^2 - c*Log[-#1 + 
 Tan[(e + f*x)/4]]*#1^3)/(-d - c*#1 + 3*d*#1^2 - c*#1^3) & ])*(Cos[(e + f* 
x)/2] + Sin[(e + f*x)/2]))/(2*(c - d)*Sqrt[d]*Sqrt[c + d]*f*Sqrt[a*(1 + Si 
n[e + f*x])])
 

Rubi [A] (verified)

Time = 0.62 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.189, Rules used = {3042, 3464, 3042, 3128, 219, 3252, 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 {A+B \sin (e+f x)}{\sqrt {a \sin (e+f x)+a} (c+d \sin (e+f x))} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3464

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3128

\(\displaystyle \frac {(B c-A d) \int \frac {\sqrt {\sin (e+f x) a+a}}{c+d \sin (e+f x)}dx}{a (c-d)}-\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 (c-d)}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {(B c-A d) \int \frac {\sqrt {\sin (e+f x) a+a}}{c+d \sin (e+f x)}dx}{a (c-d)}-\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 (c-d)}\)

\(\Big \downarrow \) 3252

\(\displaystyle -\frac {2 (B c-A d) \int \frac {1}{a (c+d)-\frac {a^2 d \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 (c-d)}-\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 (c-d)}\)

\(\Big \downarrow \) 221

\(\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 (c-d)}-\frac {2 (B c-A d) \text {arctanh}\left (\frac {\sqrt {a} \sqrt {d} \cos (e+f x)}{\sqrt {c+d} \sqrt {a \sin (e+f x)+a}}\right )}{\sqrt {a} \sqrt {d} f (c-d) \sqrt {c+d}}\)

Input:

Int[(A + B*Sin[e + f*x])/(Sqrt[a + a*Sin[e + f*x]]*(c + d*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]*(c - d)*f)) - (2*(B*c - A*d)*ArcTanh[(Sqrt[a]*Sqrt[d 
]*Cos[e + f*x])/(Sqrt[c + d]*Sqrt[a + a*Sin[e + f*x]])])/(Sqrt[a]*(c - d)* 
Sqrt[d]*Sqrt[c + d]*f)
 

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 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 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 3252
Int[Sqrt[(a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]]/((c_.) + (d_.)*sin[(e_.) + ( 
f_.)*(x_)]), x_Symbol] :> Simp[-2*(b/f)   Subst[Int[1/(b*c + a*d - d*x^2), 
x], x, b*(Cos[e + f*x]/Sqrt[a + b*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 3464
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(Sqrt[(a_) + (b_.)*sin[(e_.) + 
(f_.)*(x_)]]*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[(A 
*b - a*B)/(b*c - a*d)   Int[1/Sqrt[a + b*Sin[e + f*x]], x], x] + Simp[(B*c 
- A*d)/(b*c - a*d)   Int[Sqrt[a + b*Sin[e + f*x]]/(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 [A] (verified)

Time = 0.43 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.46

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 {2}\, \operatorname {arctanh}\left (\frac {\sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) \sqrt {\left (c +d \right ) a d}\, A -2 A \,\operatorname {arctanh}\left (\frac {\sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, d}{\sqrt {\left (c +d \right ) a d}}\right ) \sqrt {a}\, d -\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) \sqrt {\left (c +d \right ) a d}\, B +2 B \,\operatorname {arctanh}\left (\frac {\sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, d}{\sqrt {\left (c +d \right ) a d}}\right ) \sqrt {a}\, c \right )}{\left (c -d \right ) \sqrt {a}\, \sqrt {\left (c +d \right ) a d}\, \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) \(199\)

Input:

int((A+B*sin(f*x+e))/(a+a*sin(f*x+e))^(1/2)/(c+d*sin(f*x+e)),x,method=_RET 
URNVERBOSE)
 

Output:

-(1+sin(f*x+e))*(-a*(sin(f*x+e)-1))^(1/2)*(2^(1/2)*arctanh(1/2*(-a*(sin(f* 
x+e)-1))^(1/2)*2^(1/2)/a^(1/2))*((c+d)*a*d)^(1/2)*A-2*A*arctanh((-a*(sin(f 
*x+e)-1))^(1/2)*d/((c+d)*a*d)^(1/2))*a^(1/2)*d-2^(1/2)*arctanh(1/2*(-a*(si 
n(f*x+e)-1))^(1/2)*2^(1/2)/a^(1/2))*((c+d)*a*d)^(1/2)*B+2*B*arctanh((-a*(s 
in(f*x+e)-1))^(1/2)*d/((c+d)*a*d)^(1/2))*a^(1/2)*c)/(c-d)/a^(1/2)/((c+d)*a 
*d)^(1/2)/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. 246 vs. \(2 (113) = 226\).

Time = 0.68 (sec) , antiderivative size = 744, normalized size of antiderivative = 5.47 \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \sin (e+f x))} \, dx =\text {Too large to display} \] Input:

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

Output:

[1/2*(sqrt(a*c*d + a*d^2)*(B*c - A*d)*log((a*d^2*cos(f*x + e)^3 - a*c^2 - 
2*a*c*d - a*d^2 - (6*a*c*d + 7*a*d^2)*cos(f*x + e)^2 - 4*sqrt(a*c*d + a*d^ 
2)*(d*cos(f*x + e)^2 - (c + 2*d)*cos(f*x + e) + (d*cos(f*x + e) + c + 3*d) 
*sin(f*x + e) - c - 3*d)*sqrt(a*sin(f*x + e) + a) - (a*c^2 + 8*a*c*d + 9*a 
*d^2)*cos(f*x + e) + (a*d^2*cos(f*x + e)^2 - a*c^2 - 2*a*c*d - a*d^2 + 2*( 
3*a*c*d + 4*a*d^2)*cos(f*x + e))*sin(f*x + e))/(d^2*cos(f*x + e)^3 + (2*c* 
d + d^2)*cos(f*x + e)^2 - c^2 - 2*c*d - d^2 - (c^2 + d^2)*cos(f*x + e) + ( 
d^2*cos(f*x + e)^2 - 2*c*d*cos(f*x + e) - c^2 - 2*c*d - d^2)*sin(f*x + e)) 
) + sqrt(2)*((A - B)*a*c*d + (A - B)*a*d^2)*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))/((a*c^2*d - a*d^ 
3)*f), -1/2*(2*sqrt(-a*c*d - a*d^2)*(B*c - A*d)*arctan(1/2*sqrt(-a*c*d - a 
*d^2)*sqrt(a*sin(f*x + e) + a)*(d*sin(f*x + e) - c - 2*d)/((a*c*d + a*d^2) 
*cos(f*x + e))) - sqrt(2)*((A - B)*a*c*d + (A - B)*a*d^2)*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))/(( 
a*c^2*d - a*d^3)*f)]
 

Sympy [F(-1)]

Timed out. \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \sin (e+f x))} \, dx=\text {Timed out} \] Input:

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

Output:

Timed out
 

Maxima [F]

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

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

Output:

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

Giac [F(-2)]

Exception generated. \[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \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)/(c+d*sin(f*x+e)),x, algo 
rithm="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 [F(-1)]

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

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

Output:

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

Reduce [F]

\[ \int \frac {A+B \sin (e+f x)}{\sqrt {a+a \sin (e+f x)} (c+d \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 )^{2} d +\sin \left (f x +e \right ) c +\sin \left (f x +e \right ) d +c}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 )^{2} d +\sin \left (f x +e \right ) c +\sin \left (f x +e \right ) d +c}d x \right ) b \right )}{a} \] Input:

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

Output:

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