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

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

Optimal result

Integrand size = 33, antiderivative size = 124 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\frac {a B x}{d^2}+\frac {2 a \left ((A+B) (c-d) d^2-B c \left (c^2-d^2\right )\right ) \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \left (c^2-d^2\right )^{3/2} f}+\frac {a (B c-A d) \cos (e+f x)}{d (c+d) f (c+d \sin (e+f x))} \] Output:

a*B*x/d^2+2*a*((A+B)*(c-d)*d^2-B*c*(c^2-d^2))*arctan((d+c*tan(1/2*f*x+1/2* 
e))/(c^2-d^2)^(1/2))/d^2/(c^2-d^2)^(3/2)/f+a*(-A*d+B*c)*cos(f*x+e)/d/(c+d) 
/f/(c+d*sin(f*x+e))
 

Mathematica [C] (warning: unable to verify)

Result contains complex when optimal does not.

Time = 3.63 (sec) , antiderivative size = 217, normalized size of antiderivative = 1.75 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\frac {a (1+\sin (e+f x)) \left (B x+\frac {2 \left (A d^2-B \left (c^2+c d-d^2\right )\right ) \arctan \left (\frac {\sec \left (\frac {f x}{2}\right ) (\cos (e)-i \sin (e)) \left (d \cos \left (e+\frac {f x}{2}\right )+c \sin \left (\frac {f x}{2}\right )\right )}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}\right ) (\cos (e)-i \sin (e))}{(c+d) \sqrt {c^2-d^2} f \sqrt {(\cos (e)-i \sin (e))^2}}+\frac {(-B c+A d) \csc (e) (c \cos (e)+d \sin (f x))}{(c+d) f (c+d \sin (e+f x))}\right )}{d^2 \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2} \] Input:

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

Output:

(a*(1 + Sin[e + f*x])*(B*x + (2*(A*d^2 - B*(c^2 + c*d - d^2))*ArcTan[(Sec[ 
(f*x)/2]*(Cos[e] - I*Sin[e])*(d*Cos[e + (f*x)/2] + c*Sin[(f*x)/2]))/(Sqrt[ 
c^2 - d^2]*Sqrt[(Cos[e] - I*Sin[e])^2])]*(Cos[e] - I*Sin[e]))/((c + d)*Sqr 
t[c^2 - d^2]*f*Sqrt[(Cos[e] - I*Sin[e])^2]) + ((-(B*c) + A*d)*Csc[e]*(c*Co 
s[e] + d*Sin[f*x]))/((c + d)*f*(c + d*Sin[e + f*x]))))/(d^2*(Cos[(e + f*x) 
/2] + Sin[(e + f*x)/2])^2)
 

Rubi [A] (verified)

Time = 0.73 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.25, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 3447, 3042, 3500, 25, 3042, 3214, 3042, 3139, 1083, 217}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3447

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3500

\(\displaystyle \frac {a (B c-A d) \cos (e+f x)}{d f (c+d) (c+d \sin (e+f x))}-\frac {\int -\frac {a (A+B) (c-d) d+a B \left (c^2-d^2\right ) \sin (e+f x)}{c+d \sin (e+f x)}dx}{d \left (c^2-d^2\right )}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {a (A+B) (c-d) d+a B \left (c^2-d^2\right ) \sin (e+f x)}{c+d \sin (e+f x)}dx}{d \left (c^2-d^2\right )}+\frac {a (B c-A d) \cos (e+f x)}{d f (c+d) (c+d \sin (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {a (A+B) (c-d) d+a B \left (c^2-d^2\right ) \sin (e+f x)}{c+d \sin (e+f x)}dx}{d \left (c^2-d^2\right )}+\frac {a (B c-A d) \cos (e+f x)}{d f (c+d) (c+d \sin (e+f x))}\)

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

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

\(\Big \downarrow \) 1083

\(\displaystyle \frac {\frac {a B x \left (c^2-d^2\right )}{d}-\frac {4 a (c-d) \left (A d^2-B \left (c^2+c d-d^2\right )\right ) \int \frac {1}{-\left (2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )^2-4 \left (c^2-d^2\right )}d\left (2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )}{d f}}{d \left (c^2-d^2\right )}+\frac {a (B c-A d) \cos (e+f x)}{d f (c+d) (c+d \sin (e+f x))}\)

\(\Big \downarrow \) 217

\(\displaystyle \frac {\frac {2 a (c-d) \left (A d^2-B \left (c^2+c d-d^2\right )\right ) \arctan \left (\frac {2 c \tan \left (\frac {1}{2} (e+f x)\right )+2 d}{2 \sqrt {c^2-d^2}}\right )}{d f \sqrt {c^2-d^2}}+\frac {a B x \left (c^2-d^2\right )}{d}}{d \left (c^2-d^2\right )}+\frac {a (B c-A d) \cos (e+f x)}{d f (c+d) (c+d \sin (e+f x))}\)

Input:

Int[((a + a*Sin[e + f*x])*(A + B*Sin[e + f*x]))/(c + d*Sin[e + f*x])^2,x]
 

Output:

((a*B*(c^2 - d^2)*x)/d + (2*a*(c - d)*(A*d^2 - B*(c^2 + c*d - d^2))*ArcTan 
[(2*d + 2*c*Tan[(e + f*x)/2])/(2*Sqrt[c^2 - d^2])])/(d*Sqrt[c^2 - d^2]*f)) 
/(d*(c^2 - d^2)) + (a*(B*c - A*d)*Cos[e + f*x])/(d*(c + d)*f*(c + d*Sin[e 
+ f*x]))
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

rule 1083
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2   Subst[I 
nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, 
x]
 

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

rule 3139
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = Fre 
eFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + 2*b*e*x + a 
*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ 
[a^2 - b^2, 0]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3447
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Int[(a 
 + b*Sin[e + f*x])^m*(A*c + (B*c + A*d)*Sin[e + f*x] + B*d*Sin[e + f*x]^2), 
 x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0]
 

rule 3500
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + 
 (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-(A*b^2 
 - a*b*B + a^2*C))*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1)* 
(a^2 - b^2))), x] + Simp[1/(b*(m + 1)*(a^2 - b^2))   Int[(a + b*Sin[e + f*x 
])^(m + 1)*Simp[b*(a*A - b*B + a*C)*(m + 1) - (A*b^2 - a*b*B + a^2*C + b*(A 
*b - a*B + b*C)*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, 
B, C}, x] && LtQ[m, -1] && NeQ[a^2 - b^2, 0]
 
Maple [A] (verified)

Time = 0.46 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.40

method result size
derivativedivides \(\frac {2 a \left (\frac {\frac {-\frac {d^{2} \left (A d -B c \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c +d \right ) c}-\frac {d \left (A d -B c \right )}{c +d}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c +2 d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+c}+\frac {\left (A \,d^{2}-B \,c^{2}-B c d +B \,d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{\left (c +d \right ) \sqrt {c^{2}-d^{2}}}}{d^{2}}+\frac {B \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) \(174\)
default \(\frac {2 a \left (\frac {\frac {-\frac {d^{2} \left (A d -B c \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c +d \right ) c}-\frac {d \left (A d -B c \right )}{c +d}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c +2 d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+c}+\frac {\left (A \,d^{2}-B \,c^{2}-B c d +B \,d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{\left (c +d \right ) \sqrt {c^{2}-d^{2}}}}{d^{2}}+\frac {B \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) \(174\)
risch \(\frac {a B x}{d^{2}}-\frac {2 i a \left (-A d +B c \right ) \left (i d +c \,{\mathrm e}^{i \left (f x +e \right )}\right )}{d^{2} \left (c +d \right ) f \left (-i d \,{\mathrm e}^{2 i \left (f x +e \right )}+i d +2 c \,{\mathrm e}^{i \left (f x +e \right )}\right )}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) A}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B \,c^{2}}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f \,d^{2}}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B c}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f d}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) A}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B \,c^{2}}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f \,d^{2}}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B c}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f d}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) B}{\sqrt {-c^{2}+d^{2}}\, \left (c +d \right ) f}\) \(680\)

Input:

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

Output:

2/f*a*(1/d^2*((-d^2*(A*d-B*c)/(c+d)/c*tan(1/2*f*x+1/2*e)-d*(A*d-B*c)/(c+d) 
)/(tan(1/2*f*x+1/2*e)^2*c+2*d*tan(1/2*f*x+1/2*e)+c)+(A*d^2-B*c^2-B*c*d+B*d 
^2)/(c+d)/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2 
)^(1/2)))+B/d^2*arctan(tan(1/2*f*x+1/2*e)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 284 vs. \(2 (119) = 238\).

Time = 0.12 (sec) , antiderivative size = 655, normalized size of antiderivative = 5.28 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\left [\frac {2 \, {\left (B a c^{3} d + B a c^{2} d^{2} - B a c d^{3} - B a d^{4}\right )} f x \sin \left (f x + e\right ) + 2 \, {\left (B a c^{4} + B a c^{3} d - B a c^{2} d^{2} - B a c d^{3}\right )} f x + {\left (B a c^{3} + B a c^{2} d - {\left (A + B\right )} a c d^{2} + {\left (B a c^{2} d + B a c d^{2} - {\left (A + B\right )} a d^{3}\right )} \sin \left (f x + e\right )\right )} \sqrt {-c^{2} + d^{2}} \log \left (\frac {{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \, {\left (c \cos \left (f x + e\right ) \sin \left (f x + e\right ) + d \cos \left (f x + e\right )\right )} \sqrt {-c^{2} + d^{2}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right ) + 2 \, {\left (B a c^{3} d - A a c^{2} d^{2} - B a c d^{3} + A a d^{4}\right )} \cos \left (f x + e\right )}{2 \, {\left ({\left (c^{3} d^{3} + c^{2} d^{4} - c d^{5} - d^{6}\right )} f \sin \left (f x + e\right ) + {\left (c^{4} d^{2} + c^{3} d^{3} - c^{2} d^{4} - c d^{5}\right )} f\right )}}, \frac {{\left (B a c^{3} d + B a c^{2} d^{2} - B a c d^{3} - B a d^{4}\right )} f x \sin \left (f x + e\right ) + {\left (B a c^{4} + B a c^{3} d - B a c^{2} d^{2} - B a c d^{3}\right )} f x + {\left (B a c^{3} + B a c^{2} d - {\left (A + B\right )} a c d^{2} + {\left (B a c^{2} d + B a c d^{2} - {\left (A + B\right )} a d^{3}\right )} \sin \left (f x + e\right )\right )} \sqrt {c^{2} - d^{2}} \arctan \left (-\frac {c \sin \left (f x + e\right ) + d}{\sqrt {c^{2} - d^{2}} \cos \left (f x + e\right )}\right ) + {\left (B a c^{3} d - A a c^{2} d^{2} - B a c d^{3} + A a d^{4}\right )} \cos \left (f x + e\right )}{{\left (c^{3} d^{3} + c^{2} d^{4} - c d^{5} - d^{6}\right )} f \sin \left (f x + e\right ) + {\left (c^{4} d^{2} + c^{3} d^{3} - c^{2} d^{4} - c d^{5}\right )} f}\right ] \] Input:

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

Output:

[1/2*(2*(B*a*c^3*d + B*a*c^2*d^2 - B*a*c*d^3 - B*a*d^4)*f*x*sin(f*x + e) + 
 2*(B*a*c^4 + B*a*c^3*d - B*a*c^2*d^2 - B*a*c*d^3)*f*x + (B*a*c^3 + B*a*c^ 
2*d - (A + B)*a*c*d^2 + (B*a*c^2*d + B*a*c*d^2 - (A + B)*a*d^3)*sin(f*x + 
e))*sqrt(-c^2 + d^2)*log(((2*c^2 - d^2)*cos(f*x + e)^2 - 2*c*d*sin(f*x + e 
) - c^2 - d^2 + 2*(c*cos(f*x + e)*sin(f*x + e) + d*cos(f*x + e))*sqrt(-c^2 
 + d^2))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)) + 2*(B*a*c 
^3*d - A*a*c^2*d^2 - B*a*c*d^3 + A*a*d^4)*cos(f*x + e))/((c^3*d^3 + c^2*d^ 
4 - c*d^5 - d^6)*f*sin(f*x + e) + (c^4*d^2 + c^3*d^3 - c^2*d^4 - c*d^5)*f) 
, ((B*a*c^3*d + B*a*c^2*d^2 - B*a*c*d^3 - B*a*d^4)*f*x*sin(f*x + e) + (B*a 
*c^4 + B*a*c^3*d - B*a*c^2*d^2 - B*a*c*d^3)*f*x + (B*a*c^3 + B*a*c^2*d - ( 
A + B)*a*c*d^2 + (B*a*c^2*d + B*a*c*d^2 - (A + B)*a*d^3)*sin(f*x + e))*sqr 
t(c^2 - d^2)*arctan(-(c*sin(f*x + e) + d)/(sqrt(c^2 - d^2)*cos(f*x + e))) 
+ (B*a*c^3*d - A*a*c^2*d^2 - B*a*c*d^3 + A*a*d^4)*cos(f*x + e))/((c^3*d^3 
+ c^2*d^4 - c*d^5 - d^6)*f*sin(f*x + e) + (c^4*d^2 + c^3*d^3 - c^2*d^4 - c 
*d^5)*f)]
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\text {Exception raised: ValueError} \] Input:

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*d^2-4*c^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 197, normalized size of antiderivative = 1.59 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\frac {\frac {{\left (f x + e\right )} B a}{d^{2}} - \frac {2 \, {\left (B a c^{2} + B a c d - A a d^{2} - B a d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{{\left (c d^{2} + d^{3}\right )} \sqrt {c^{2} - d^{2}}} + \frac {2 \, {\left (B a c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - A a d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + B a c^{2} - A a c d\right )}}{{\left (c^{2} d + c d^{2}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + c\right )}}}{f} \] Input:

integrate((a+a*sin(f*x+e))*(A+B*sin(f*x+e))/(c+d*sin(f*x+e))^2,x, algorith 
m="giac")
 

Output:

((f*x + e)*B*a/d^2 - 2*(B*a*c^2 + B*a*c*d - A*a*d^2 - B*a*d^2)*(pi*floor(1 
/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c 
^2 - d^2)))/((c*d^2 + d^3)*sqrt(c^2 - d^2)) + 2*(B*a*c*d*tan(1/2*f*x + 1/2 
*e) - A*a*d^2*tan(1/2*f*x + 1/2*e) + B*a*c^2 - A*a*c*d)/((c^2*d + c*d^2)*( 
c*tan(1/2*f*x + 1/2*e)^2 + 2*d*tan(1/2*f*x + 1/2*e) + c)))/f
 

Mupad [B] (verification not implemented)

Time = 43.62 (sec) , antiderivative size = 5102, normalized size of antiderivative = 41.15 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\text {Too large to display} \] Input:

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

Output:

(2*B*a*atan(((B*a*((32*(B^2*a^2*c^2*d^3 + 2*B^2*a^2*c^3*d^2 + B^2*a^2*c^4* 
d))/(2*c*d^3 + d^4 + c^2*d^2) + (32*tan(e/2 + (f*x)/2)*(6*B^2*a^2*c^2*d^4 
+ 2*B^2*a^2*c^3*d^3 - 4*B^2*a^2*c^4*d^2 - A^2*a^2*c*d^5 + B^2*a^2*c*d^5 - 
2*B^2*a^2*c^5*d + 2*A*B*a^2*c^2*d^4 + 2*A*B*a^2*c^3*d^3 - 2*A*B*a^2*c*d^5) 
)/(2*c*d^4 + d^5 + c^2*d^3) + (B*a*((32*tan(e/2 + (f*x)/2)*(2*A*a*c*d^7 + 
2*B*a*c*d^7 + 2*A*a*c^2*d^6 - 4*B*a*c^3*d^5 - 2*B*a*c^4*d^4))/(2*c*d^4 + d 
^5 + c^2*d^3) - (32*(B*a*c*d^6 - A*a*c^2*d^5 - A*a*c^3*d^4 + B*a*c^2*d^5)) 
/(2*c*d^3 + d^4 + c^2*d^2) + (B*a*((32*(c^2*d^7 + 2*c^3*d^6 + c^4*d^5))/(2 
*c*d^3 + d^4 + c^2*d^2) + (32*tan(e/2 + (f*x)/2)*(3*c*d^9 + 6*c^2*d^8 + c^ 
3*d^7 - 4*c^4*d^6 - 2*c^5*d^5))/(2*c*d^4 + d^5 + c^2*d^3))*1i)/d^2)*1i)/d^ 
2))/d^2 + (B*a*((32*(B^2*a^2*c^2*d^3 + 2*B^2*a^2*c^3*d^2 + B^2*a^2*c^4*d)) 
/(2*c*d^3 + d^4 + c^2*d^2) + (32*tan(e/2 + (f*x)/2)*(6*B^2*a^2*c^2*d^4 + 2 
*B^2*a^2*c^3*d^3 - 4*B^2*a^2*c^4*d^2 - A^2*a^2*c*d^5 + B^2*a^2*c*d^5 - 2*B 
^2*a^2*c^5*d + 2*A*B*a^2*c^2*d^4 + 2*A*B*a^2*c^3*d^3 - 2*A*B*a^2*c*d^5))/( 
2*c*d^4 + d^5 + c^2*d^3) + (B*a*((32*(B*a*c*d^6 - A*a*c^2*d^5 - A*a*c^3*d^ 
4 + B*a*c^2*d^5))/(2*c*d^3 + d^4 + c^2*d^2) - (32*tan(e/2 + (f*x)/2)*(2*A* 
a*c*d^7 + 2*B*a*c*d^7 + 2*A*a*c^2*d^6 - 4*B*a*c^3*d^5 - 2*B*a*c^4*d^4))/(2 
*c*d^4 + d^5 + c^2*d^3) + (B*a*((32*(c^2*d^7 + 2*c^3*d^6 + c^4*d^5))/(2*c* 
d^3 + d^4 + c^2*d^2) + (32*tan(e/2 + (f*x)/2)*(3*c*d^9 + 6*c^2*d^8 + c^3*d 
^7 - 4*c^4*d^6 - 2*c^5*d^5))/(2*c*d^4 + d^5 + c^2*d^3))*1i)/d^2)*1i)/d^...
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 599, normalized size of antiderivative = 4.83 \[ \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\frac {a \left (2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) \sin \left (f x +e \right ) a \,d^{3}-2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) \sin \left (f x +e \right ) b \,c^{2} d -2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) \sin \left (f x +e \right ) b c \,d^{2}+2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) \sin \left (f x +e \right ) b \,d^{3}+2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) a c \,d^{2}-2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) b \,c^{3}-2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) b \,c^{2} d +2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) b c \,d^{2}-\cos \left (f x +e \right ) a \,c^{2} d^{2}+\cos \left (f x +e \right ) a \,d^{4}+\cos \left (f x +e \right ) b \,c^{3} d -\cos \left (f x +e \right ) b c \,d^{3}+\sin \left (f x +e \right ) b \,c^{3} d f x +\sin \left (f x +e \right ) b \,c^{2} d^{2} f x -\sin \left (f x +e \right ) b c \,d^{3} f x -\sin \left (f x +e \right ) b \,d^{4} f x +b \,c^{4} f x +b \,c^{3} d f x -b \,c^{2} d^{2} f x -b c \,d^{3} f x \right )}{d^{2} f \left (\sin \left (f x +e \right ) c^{3} d +\sin \left (f x +e \right ) c^{2} d^{2}-\sin \left (f x +e \right ) c \,d^{3}-\sin \left (f x +e \right ) d^{4}+c^{4}+c^{3} d -c^{2} d^{2}-c \,d^{3}\right )} \] Input:

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

Output:

(a*(2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*s 
in(e + f*x)*a*d**3 - 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqr 
t(c**2 - d**2))*sin(e + f*x)*b*c**2*d - 2*sqrt(c**2 - d**2)*atan((tan((e + 
 f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin(e + f*x)*b*c*d**2 + 2*sqrt(c**2 - d 
**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin(e + f*x)*b*d**3 
+ 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*a*c 
*d**2 - 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2 
))*b*c**3 - 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - 
d**2))*b*c**2*d + 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c 
**2 - d**2))*b*c*d**2 - cos(e + f*x)*a*c**2*d**2 + cos(e + f*x)*a*d**4 + c 
os(e + f*x)*b*c**3*d - cos(e + f*x)*b*c*d**3 + sin(e + f*x)*b*c**3*d*f*x + 
 sin(e + f*x)*b*c**2*d**2*f*x - sin(e + f*x)*b*c*d**3*f*x - sin(e + f*x)*b 
*d**4*f*x + b*c**4*f*x + b*c**3*d*f*x - b*c**2*d**2*f*x - b*c*d**3*f*x))/( 
d**2*f*(sin(e + f*x)*c**3*d + sin(e + f*x)*c**2*d**2 - sin(e + f*x)*c*d**3 
 - sin(e + f*x)*d**4 + c**4 + c**3*d - c**2*d**2 - c*d**3))