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

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

Optimal result

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

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

Mathematica [A] (verified)

Time = 4.16 (sec) , antiderivative size = 188, normalized size of antiderivative = 0.94 \[ \int \frac {(a+b \sin (e+f x))^2 (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\frac {b (-2 b B c+A b d+2 a B d) (e+f x)+\frac {2 (b c-a d) \left (a d^2 (-A c+B d)+b \left (2 B c^3-A c^2 d-3 B c d^2+2 A d^3\right )\right ) \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\left (c^2-d^2\right )^{3/2}}-b^2 B d \cos (e+f x)+\frac {d (b c-a d)^2 (-B c+A d) \cos (e+f x)}{(c-d) (c+d) (c+d \sin (e+f x))}}{d^3 f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 1.13 (sec) , antiderivative size = 234, normalized size of antiderivative = 1.18, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.314, Rules used = {3042, 3467, 25, 3042, 3502, 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+b \sin (e+f x))^2 (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3467

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

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

\(\Big \downarrow \) 1083

\(\displaystyle -\frac {\frac {b x \left (c^2-d^2\right ) (-2 a B d-A b d+2 b B c)-\frac {4 (b c-a d) \left (a d^2 (A c-B d)-b \left (-A c^2 d+2 A d^3+2 B c^3-3 B c 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 )}{f}}{d}+\frac {b^2 B \left (c^2-d^2\right ) \cos (e+f x)}{f}}{d^2 \left (c^2-d^2\right )}-\frac {(b c-a d)^2 (B c-A d) \cos (e+f x)}{d^2 f \left (c^2-d^2\right ) (c+d \sin (e+f x))}\)

\(\Big \downarrow \) 217

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

Input:

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

Output:

-(((b*(2*b*B*c - A*b*d - 2*a*B*d)*(c^2 - d^2)*x + (2*(b*c - a*d)*(a*d^2*(A 
*c - B*d) - b*(2*B*c^3 - A*c^2*d - 3*B*c*d^2 + 2*A*d^3))*ArcTan[(2*d + 2*c 
*Tan[(e + f*x)/2])/(2*Sqrt[c^2 - d^2])])/(Sqrt[c^2 - d^2]*f))/d + (b^2*B*( 
c^2 - d^2)*Cos[e + f*x])/f)/(d^2*(c^2 - d^2))) - ((b*c - a*d)^2*(B*c - A*d 
)*Cos[e + f*x])/(d^2*(c^2 - d^2)*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 3467
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2*((A_.) + (B_.)*sin[(e_.) + (f 
_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[ 
(B*c - A*d)*(b*c - a*d)^2*Cos[e + f*x]*((c + d*Sin[e + f*x])^(n + 1)/(f*d^2 
*(n + 1)*(c^2 - d^2))), x] - Simp[1/(d^2*(n + 1)*(c^2 - d^2))   Int[(c + d* 
Sin[e + f*x])^(n + 1)*Simp[d*(n + 1)*(B*(b*c - a*d)^2 - A*d*(a^2*c + b^2*c 
- 2*a*b*d)) - ((B*c - A*d)*(a^2*d^2*(n + 2) + b^2*(c^2 + d^2*(n + 1))) + 2* 
a*b*d*(A*c*d*(n + 2) - B*(c^2 + d^2*(n + 1))))*Sin[e + f*x] - b^2*B*d*(n + 
1)*(c^2 - d^2)*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B} 
, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[ 
n, -1]
 

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

Time = 0.98 (sec) , antiderivative size = 374, normalized size of antiderivative = 1.88

method result size
derivativedivides \(\frac {\frac {\frac {2 \left (\frac {d^{2} \left (A \,a^{2} d^{3}-2 A a b c \,d^{2}+A \,b^{2} c^{2} d -B \,a^{2} c \,d^{2}+2 B a b \,c^{2} d -c^{3} b^{2} B \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) c}+\frac {d \left (A \,a^{2} d^{3}-2 A a b c \,d^{2}+A \,b^{2} c^{2} d -B \,a^{2} c \,d^{2}+2 B a b \,c^{2} d -c^{3} b^{2} B \right )}{c^{2}-d^{2}}\right )}{\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 {2 \left (A \,a^{2} c \,d^{3}-2 A a b \,d^{4}-A \,b^{2} c^{3} d +2 A \,b^{2} c \,d^{3}-B \,a^{2} d^{4}-2 B a b \,c^{3} d +4 B a b c \,d^{3}+2 B \,b^{2} c^{4}-3 B \,b^{2} c^{2} 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^{2}-d^{2}\right )^{\frac {3}{2}}}}{d^{3}}+\frac {2 b \left (-\frac {B b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (A b d +2 B a d -2 B b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{3}}}{f}\) \(374\)
default \(\frac {\frac {\frac {2 \left (\frac {d^{2} \left (A \,a^{2} d^{3}-2 A a b c \,d^{2}+A \,b^{2} c^{2} d -B \,a^{2} c \,d^{2}+2 B a b \,c^{2} d -c^{3} b^{2} B \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) c}+\frac {d \left (A \,a^{2} d^{3}-2 A a b c \,d^{2}+A \,b^{2} c^{2} d -B \,a^{2} c \,d^{2}+2 B a b \,c^{2} d -c^{3} b^{2} B \right )}{c^{2}-d^{2}}\right )}{\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 {2 \left (A \,a^{2} c \,d^{3}-2 A a b \,d^{4}-A \,b^{2} c^{3} d +2 A \,b^{2} c \,d^{3}-B \,a^{2} d^{4}-2 B a b \,c^{3} d +4 B a b c \,d^{3}+2 B \,b^{2} c^{4}-3 B \,b^{2} c^{2} 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^{2}-d^{2}\right )^{\frac {3}{2}}}}{d^{3}}+\frac {2 b \left (-\frac {B b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (A b d +2 B a d -2 B b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{3}}}{f}\) \(374\)
risch \(\text {Expression too large to display}\) \(1721\)

Input:

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

Output:

1/f*(2/d^3*((d^2*(A*a^2*d^3-2*A*a*b*c*d^2+A*b^2*c^2*d-B*a^2*c*d^2+2*B*a*b* 
c^2*d-B*b^2*c^3)/(c^2-d^2)/c*tan(1/2*f*x+1/2*e)+d*(A*a^2*d^3-2*A*a*b*c*d^2 
+A*b^2*c^2*d-B*a^2*c*d^2+2*B*a*b*c^2*d-B*b^2*c^3)/(c^2-d^2))/(tan(1/2*f*x+ 
1/2*e)^2*c+2*d*tan(1/2*f*x+1/2*e)+c)+(A*a^2*c*d^3-2*A*a*b*d^4-A*b^2*c^3*d+ 
2*A*b^2*c*d^3-B*a^2*d^4-2*B*a*b*c^3*d+4*B*a*b*c*d^3+2*B*b^2*c^4-3*B*b^2*c^ 
2*d^2)/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^( 
1/2)))+2*b/d^3*(-B*b*d/(1+tan(1/2*f*x+1/2*e)^2)+(A*b*d+2*B*a*d-2*B*b*c)*ar 
ctan(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. 611 vs. \(2 (194) = 388\).

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

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

Output:

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

Sympy [F(-1)]

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

integrate((a+b*sin(f*x+e))**2*(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+b \sin (e+f x))^2 (A+B \sin (e+f x))}{(c+d \sin (e+f x))^2} \, dx=\text {Exception raised: ValueError} \] Input:

integrate((a+b*sin(f*x+e))^2*(A+B*sin(f*x+e))/(c+d*sin(f*x+e))^2,x, algori 
thm="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 [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 749 vs. \(2 (194) = 388\).

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

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

Output:

(2*(2*B*b^2*c^4 - 2*B*a*b*c^3*d - A*b^2*c^3*d - 3*B*b^2*c^2*d^2 + A*a^2*c* 
d^3 + 4*B*a*b*c*d^3 + 2*A*b^2*c*d^3 - B*a^2*d^4 - 2*A*a*b*d^4)*(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^2*d^3 - d^5)*sqrt(c^2 - d^2)) - 2*(B*b^2*c^3*d*tan(1/2*f*x 
 + 1/2*e)^3 - 2*B*a*b*c^2*d^2*tan(1/2*f*x + 1/2*e)^3 - A*b^2*c^2*d^2*tan(1 
/2*f*x + 1/2*e)^3 + B*a^2*c*d^3*tan(1/2*f*x + 1/2*e)^3 + 2*A*a*b*c*d^3*tan 
(1/2*f*x + 1/2*e)^3 - A*a^2*d^4*tan(1/2*f*x + 1/2*e)^3 + 2*B*b^2*c^4*tan(1 
/2*f*x + 1/2*e)^2 - 2*B*a*b*c^3*d*tan(1/2*f*x + 1/2*e)^2 - A*b^2*c^3*d*tan 
(1/2*f*x + 1/2*e)^2 + B*a^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^2 + 2*A*a*b*c^2*d 
^2*tan(1/2*f*x + 1/2*e)^2 - B*b^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^2 - A*a^2*c 
*d^3*tan(1/2*f*x + 1/2*e)^2 + 3*B*b^2*c^3*d*tan(1/2*f*x + 1/2*e) - 2*B*a*b 
*c^2*d^2*tan(1/2*f*x + 1/2*e) - A*b^2*c^2*d^2*tan(1/2*f*x + 1/2*e) + B*a^2 
*c*d^3*tan(1/2*f*x + 1/2*e) + 2*A*a*b*c*d^3*tan(1/2*f*x + 1/2*e) - 2*B*b^2 
*c*d^3*tan(1/2*f*x + 1/2*e) - A*a^2*d^4*tan(1/2*f*x + 1/2*e) + 2*B*b^2*c^4 
 - 2*B*a*b*c^3*d - A*b^2*c^3*d + B*a^2*c^2*d^2 + 2*A*a*b*c^2*d^2 - B*b^2*c 
^2*d^2 - A*a^2*c*d^3)/((c^3*d^2 - c*d^4)*(c*tan(1/2*f*x + 1/2*e)^4 + 2*d*t 
an(1/2*f*x + 1/2*e)^3 + 2*c*tan(1/2*f*x + 1/2*e)^2 + 2*d*tan(1/2*f*x + 1/2 
*e) + c)) - (2*B*b^2*c - 2*B*a*b*d - A*b^2*d)*(f*x + e)/d^3)/f
 

Mupad [B] (verification not implemented)

Time = 55.73 (sec) , antiderivative size = 16312, normalized size of antiderivative = 81.97 \[ \int \frac {(a+b \sin (e+f x))^2 (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 + b*sin(e + f*x))^2)/(c + d*sin(e + f*x))^2,x 
)
 

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

(2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin( 
e + f*x)*a**3*c*d**4 - 6*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/s 
qrt(c**2 - d**2))*sin(e + f*x)*a**2*b*d**5 - 6*sqrt(c**2 - d**2)*atan((tan 
((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin(e + f*x)*a*b**2*c**3*d**2 + 12 
*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin(e 
+ f*x)*a*b**2*c*d**4 + 4*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/s 
qrt(c**2 - d**2))*sin(e + f*x)*b**3*c**4*d - 6*sqrt(c**2 - d**2)*atan((tan 
((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*sin(e + f*x)*b**3*c**2*d**3 + 2*sq 
rt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*a**3*c**2 
*d**3 - 6*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2 
))*a**2*b*c*d**4 - 6*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt( 
c**2 - d**2))*a*b**2*c**4*d + 12*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)* 
c + d)/sqrt(c**2 - d**2))*a*b**2*c**2*d**3 + 4*sqrt(c**2 - d**2)*atan((tan 
((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*b**3*c**5 - 6*sqrt(c**2 - d**2)*at 
an((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2))*b**3*c**3*d**2 - cos(e + f* 
x)*sin(e + f*x)*b**3*c**4*d**2 + 2*cos(e + f*x)*sin(e + f*x)*b**3*c**2*d** 
4 - cos(e + f*x)*sin(e + f*x)*b**3*d**6 + cos(e + f*x)*a**3*c**2*d**4 - co 
s(e + f*x)*a**3*d**6 - 3*cos(e + f*x)*a**2*b*c**3*d**3 + 3*cos(e + f*x)*a* 
*2*b*c*d**5 + 3*cos(e + f*x)*a*b**2*c**4*d**2 - 3*cos(e + f*x)*a*b**2*c**2 
*d**4 - 2*cos(e + f*x)*b**3*c**5*d + 3*cos(e + f*x)*b**3*c**3*d**3 - co...