\(\int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx\) [686]

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

Optimal result

Integrand size = 25, antiderivative size = 217 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {1}{8} \left (16 a b c d+4 a^2 \left (2 c^2+d^2\right )+b^2 \left (4 c^2+3 d^2\right )\right ) x-\frac {\left (8 a^2 b c d+8 b^3 c d-a^3 d^2+4 a b^2 \left (3 c^2+2 d^2\right )\right ) \cos (e+f x)}{6 b f}-\frac {\left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \cos (e+f x) \sin (e+f x)}{24 f}-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{12 b f}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f} \] Output:

1/8*(16*a*b*c*d+4*a^2*(2*c^2+d^2)+b^2*(4*c^2+3*d^2))*x-1/6*(8*a^2*b*c*d+8* 
b^3*c*d-a^3*d^2+4*a*b^2*(3*c^2+2*d^2))*cos(f*x+e)/b/f-1/24*(2*a*d*(-a*d+8* 
b*c)+3*b^2*(4*c^2+3*d^2))*cos(f*x+e)*sin(f*x+e)/f-1/12*d*(-a*d+8*b*c)*cos( 
f*x+e)*(a+b*sin(f*x+e))^2/b/f-1/4*d^2*cos(f*x+e)*(a+b*sin(f*x+e))^3/b/f
 

Mathematica [A] (verified)

Time = 2.66 (sec) , antiderivative size = 160, normalized size of antiderivative = 0.74 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {-48 \left (4 a^2 c d+3 b^2 c d+a b \left (4 c^2+3 d^2\right )\right ) \cos (e+f x)+16 b d (b c+a d) \cos (3 (e+f x))+3 \left (4 \left (16 a b c d+4 a^2 \left (2 c^2+d^2\right )+b^2 \left (4 c^2+3 d^2\right )\right ) (e+f x)-8 \left (4 a b c d+a^2 d^2+b^2 \left (c^2+d^2\right )\right ) \sin (2 (e+f x))+b^2 d^2 \sin (4 (e+f x))\right )}{96 f} \] Input:

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

Output:

(-48*(4*a^2*c*d + 3*b^2*c*d + a*b*(4*c^2 + 3*d^2))*Cos[e + f*x] + 16*b*d*( 
b*c + a*d)*Cos[3*(e + f*x)] + 3*(4*(16*a*b*c*d + 4*a^2*(2*c^2 + d^2) + b^2 
*(4*c^2 + 3*d^2))*(e + f*x) - 8*(4*a*b*c*d + a^2*d^2 + b^2*(c^2 + d^2))*Si 
n[2*(e + f*x)] + b^2*d^2*Sin[4*(e + f*x)]))/(96*f)
 

Rubi [A] (verified)

Time = 0.66 (sec) , antiderivative size = 224, normalized size of antiderivative = 1.03, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {3042, 3270, 3042, 3232, 3042, 3213}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2dx\)

\(\Big \downarrow \) 3270

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3232

\(\displaystyle \frac {\frac {1}{3} \int (a+b \sin (e+f x)) \left (b \left (12 a c^2+16 b d c+7 a d^2\right )+\left (3 \left (4 c^2+3 d^2\right ) b^2+2 a d (8 b c-a d)\right ) \sin (e+f x)\right )dx-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{3 f}}{4 b}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {1}{3} \int (a+b \sin (e+f x)) \left (b \left (12 a c^2+16 b d c+7 a d^2\right )+\left (3 \left (4 c^2+3 d^2\right ) b^2+2 a d (8 b c-a d)\right ) \sin (e+f x)\right )dx-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{3 f}}{4 b}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}\)

\(\Big \downarrow \) 3213

\(\displaystyle \frac {\frac {1}{3} \left (\frac {3}{2} b x \left (4 a^2 \left (2 c^2+d^2\right )+16 a b c d+b^2 \left (4 c^2+3 d^2\right )\right )-\frac {2 \left (a^3 \left (-d^2\right )+8 a^2 b c d+4 a b^2 \left (3 c^2+2 d^2\right )+8 b^3 c d\right ) \cos (e+f x)}{f}-\frac {b \left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \sin (e+f x) \cos (e+f x)}{2 f}\right )-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{3 f}}{4 b}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}\)

Input:

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

Output:

-1/4*(d^2*Cos[e + f*x]*(a + b*Sin[e + f*x])^3)/(b*f) + (-1/3*(d*(8*b*c - a 
*d)*Cos[e + f*x]*(a + b*Sin[e + f*x])^2)/f + ((3*b*(16*a*b*c*d + 4*a^2*(2* 
c^2 + d^2) + b^2*(4*c^2 + 3*d^2))*x)/2 - (2*(8*a^2*b*c*d + 8*b^3*c*d - a^3 
*d^2 + 4*a*b^2*(3*c^2 + 2*d^2))*Cos[e + f*x])/f - (b*(2*a*d*(8*b*c - a*d) 
+ 3*b^2*(4*c^2 + 3*d^2))*Cos[e + f*x]*Sin[e + f*x])/(2*f))/3)/(4*b)
 

Defintions of rubi rules used

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

rule 3213
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co 
s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free 
Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3232
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[1/(m + 1)   Int[(a + b*Sin[e + f*x])^(m - 1)*Simp[b* 
d*m + a*c*(m + 1) + (a*d*m + b*c*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ 
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 
 0] && IntegerQ[2*m]
 

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

Time = 0.36 (sec) , antiderivative size = 216, normalized size of antiderivative = 1.00

\[\frac {d^{2} b^{2} \left (-\frac {\left (\sin \left (f x +e \right )^{3}+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )-\frac {2 a b \,d^{2} \left (2+\sin \left (f x +e \right )^{2}\right ) \cos \left (f x +e \right )}{3}-\frac {2 b^{2} c d \left (2+\sin \left (f x +e \right )^{2}\right ) \cos \left (f x +e \right )}{3}+a^{2} d^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+4 a b c d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b^{2} c^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-2 a^{2} c d \cos \left (f x +e \right )-2 a b \,c^{2} \cos \left (f x +e \right )+a^{2} c^{2} \left (f x +e \right )}{f}\]

Input:

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

Output:

1/f*(d^2*b^2*(-1/4*(sin(f*x+e)^3+3/2*sin(f*x+e))*cos(f*x+e)+3/8*f*x+3/8*e) 
-2/3*a*b*d^2*(2+sin(f*x+e)^2)*cos(f*x+e)-2/3*b^2*c*d*(2+sin(f*x+e)^2)*cos( 
f*x+e)+a^2*d^2*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)+4*a*b*c*d*(-1/2* 
sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)+b^2*c^2*(-1/2*sin(f*x+e)*cos(f*x+e)+1 
/2*f*x+1/2*e)-2*a^2*c*d*cos(f*x+e)-2*a*b*c^2*cos(f*x+e)+a^2*c^2*(f*x+e))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 163, normalized size of antiderivative = 0.75 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {16 \, {\left (b^{2} c d + a b d^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \, {\left (16 \, a b c d + 4 \, {\left (2 \, a^{2} + b^{2}\right )} c^{2} + {\left (4 \, a^{2} + 3 \, b^{2}\right )} d^{2}\right )} f x - 48 \, {\left (a b c^{2} + a b d^{2} + {\left (a^{2} + b^{2}\right )} c d\right )} \cos \left (f x + e\right ) + 3 \, {\left (2 \, b^{2} d^{2} \cos \left (f x + e\right )^{3} - {\left (4 \, b^{2} c^{2} + 16 \, a b c d + {\left (4 \, a^{2} + 5 \, b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{24 \, f} \] Input:

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e))^2,x, algorithm="fricas")
 

Output:

1/24*(16*(b^2*c*d + a*b*d^2)*cos(f*x + e)^3 + 3*(16*a*b*c*d + 4*(2*a^2 + b 
^2)*c^2 + (4*a^2 + 3*b^2)*d^2)*f*x - 48*(a*b*c^2 + a*b*d^2 + (a^2 + b^2)*c 
*d)*cos(f*x + e) + 3*(2*b^2*d^2*cos(f*x + e)^3 - (4*b^2*c^2 + 16*a*b*c*d + 
 (4*a^2 + 5*b^2)*d^2)*cos(f*x + e))*sin(f*x + e))/f
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 459 vs. \(2 (202) = 404\).

Time = 0.35 (sec) , antiderivative size = 459, normalized size of antiderivative = 2.12 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\begin {cases} a^{2} c^{2} x - \frac {2 a^{2} c d \cos {\left (e + f x \right )}}{f} + \frac {a^{2} d^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} d^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {a^{2} d^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 a b c^{2} \cos {\left (e + f x \right )}}{f} + 2 a b c d x \sin ^{2}{\left (e + f x \right )} + 2 a b c d x \cos ^{2}{\left (e + f x \right )} - \frac {2 a b c d \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {2 a b d^{2} \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {4 a b d^{2} \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {b^{2} c^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b^{2} c^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b^{2} c^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 b^{2} c d \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {4 b^{2} c d \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {3 b^{2} d^{2} x \sin ^{4}{\left (e + f x \right )}}{8} + \frac {3 b^{2} d^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{4} + \frac {3 b^{2} d^{2} x \cos ^{4}{\left (e + f x \right )}}{8} - \frac {5 b^{2} d^{2} \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{8 f} - \frac {3 b^{2} d^{2} \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{8 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right )^{2} \left (c + d \sin {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \] Input:

integrate((a+b*sin(f*x+e))**2*(c+d*sin(f*x+e))**2,x)
 

Output:

Piecewise((a**2*c**2*x - 2*a**2*c*d*cos(e + f*x)/f + a**2*d**2*x*sin(e + f 
*x)**2/2 + a**2*d**2*x*cos(e + f*x)**2/2 - a**2*d**2*sin(e + f*x)*cos(e + 
f*x)/(2*f) - 2*a*b*c**2*cos(e + f*x)/f + 2*a*b*c*d*x*sin(e + f*x)**2 + 2*a 
*b*c*d*x*cos(e + f*x)**2 - 2*a*b*c*d*sin(e + f*x)*cos(e + f*x)/f - 2*a*b*d 
**2*sin(e + f*x)**2*cos(e + f*x)/f - 4*a*b*d**2*cos(e + f*x)**3/(3*f) + b* 
*2*c**2*x*sin(e + f*x)**2/2 + b**2*c**2*x*cos(e + f*x)**2/2 - b**2*c**2*si 
n(e + f*x)*cos(e + f*x)/(2*f) - 2*b**2*c*d*sin(e + f*x)**2*cos(e + f*x)/f 
- 4*b**2*c*d*cos(e + f*x)**3/(3*f) + 3*b**2*d**2*x*sin(e + f*x)**4/8 + 3*b 
**2*d**2*x*sin(e + f*x)**2*cos(e + f*x)**2/4 + 3*b**2*d**2*x*cos(e + f*x)* 
*4/8 - 5*b**2*d**2*sin(e + f*x)**3*cos(e + f*x)/(8*f) - 3*b**2*d**2*sin(e 
+ f*x)*cos(e + f*x)**3/(8*f), Ne(f, 0)), (x*(a + b*sin(e))**2*(c + d*sin(e 
))**2, True))
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 208, normalized size of antiderivative = 0.96 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {96 \, {\left (f x + e\right )} a^{2} c^{2} + 24 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} c^{2} + 96 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a b c d + 64 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b^{2} c d + 24 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} d^{2} + 64 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} a b d^{2} + 3 \, {\left (12 \, f x + 12 \, e + \sin \left (4 \, f x + 4 \, e\right ) - 8 \, \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} d^{2} - 192 \, a b c^{2} \cos \left (f x + e\right ) - 192 \, a^{2} c d \cos \left (f x + e\right )}{96 \, f} \] Input:

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e))^2,x, algorithm="maxima")
 

Output:

1/96*(96*(f*x + e)*a^2*c^2 + 24*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*c^2 + 
 96*(2*f*x + 2*e - sin(2*f*x + 2*e))*a*b*c*d + 64*(cos(f*x + e)^3 - 3*cos( 
f*x + e))*b^2*c*d + 24*(2*f*x + 2*e - sin(2*f*x + 2*e))*a^2*d^2 + 64*(cos( 
f*x + e)^3 - 3*cos(f*x + e))*a*b*d^2 + 3*(12*f*x + 12*e + sin(4*f*x + 4*e) 
 - 8*sin(2*f*x + 2*e))*b^2*d^2 - 192*a*b*c^2*cos(f*x + e) - 192*a^2*c*d*co 
s(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 172, normalized size of antiderivative = 0.79 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {b^{2} d^{2} \sin \left (4 \, f x + 4 \, e\right )}{32 \, f} + \frac {1}{8} \, {\left (8 \, a^{2} c^{2} + 4 \, b^{2} c^{2} + 16 \, a b c d + 4 \, a^{2} d^{2} + 3 \, b^{2} d^{2}\right )} x + \frac {{\left (b^{2} c d + a b d^{2}\right )} \cos \left (3 \, f x + 3 \, e\right )}{6 \, f} - \frac {{\left (4 \, a b c^{2} + 4 \, a^{2} c d + 3 \, b^{2} c d + 3 \, a b d^{2}\right )} \cos \left (f x + e\right )}{2 \, f} - \frac {{\left (b^{2} c^{2} + 4 \, a b c d + a^{2} d^{2} + b^{2} d^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \] Input:

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e))^2,x, algorithm="giac")
                                                                                    
                                                                                    
 

Output:

1/32*b^2*d^2*sin(4*f*x + 4*e)/f + 1/8*(8*a^2*c^2 + 4*b^2*c^2 + 16*a*b*c*d 
+ 4*a^2*d^2 + 3*b^2*d^2)*x + 1/6*(b^2*c*d + a*b*d^2)*cos(3*f*x + 3*e)/f - 
1/2*(4*a*b*c^2 + 4*a^2*c*d + 3*b^2*c*d + 3*a*b*d^2)*cos(f*x + e)/f - 1/4*( 
b^2*c^2 + 4*a*b*c*d + a^2*d^2 + b^2*d^2)*sin(2*f*x + 2*e)/f
 

Mupad [B] (verification not implemented)

Time = 17.85 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.02 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=-\frac {6\,a^2\,d^2\,\sin \left (2\,e+2\,f\,x\right )+6\,b^2\,c^2\,\sin \left (2\,e+2\,f\,x\right )+6\,b^2\,d^2\,\sin \left (2\,e+2\,f\,x\right )-\frac {3\,b^2\,d^2\,\sin \left (4\,e+4\,f\,x\right )}{4}+48\,a\,b\,c^2\,\cos \left (e+f\,x\right )+36\,a\,b\,d^2\,\cos \left (e+f\,x\right )+48\,a^2\,c\,d\,\cos \left (e+f\,x\right )+36\,b^2\,c\,d\,\cos \left (e+f\,x\right )-4\,a\,b\,d^2\,\cos \left (3\,e+3\,f\,x\right )-4\,b^2\,c\,d\,\cos \left (3\,e+3\,f\,x\right )-24\,a^2\,c^2\,f\,x-12\,a^2\,d^2\,f\,x-12\,b^2\,c^2\,f\,x-9\,b^2\,d^2\,f\,x+24\,a\,b\,c\,d\,\sin \left (2\,e+2\,f\,x\right )-48\,a\,b\,c\,d\,f\,x}{24\,f} \] Input:

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

Output:

-(6*a^2*d^2*sin(2*e + 2*f*x) + 6*b^2*c^2*sin(2*e + 2*f*x) + 6*b^2*d^2*sin( 
2*e + 2*f*x) - (3*b^2*d^2*sin(4*e + 4*f*x))/4 + 48*a*b*c^2*cos(e + f*x) + 
36*a*b*d^2*cos(e + f*x) + 48*a^2*c*d*cos(e + f*x) + 36*b^2*c*d*cos(e + f*x 
) - 4*a*b*d^2*cos(3*e + 3*f*x) - 4*b^2*c*d*cos(3*e + 3*f*x) - 24*a^2*c^2*f 
*x - 12*a^2*d^2*f*x - 12*b^2*c^2*f*x - 9*b^2*d^2*f*x + 24*a*b*c*d*sin(2*e 
+ 2*f*x) - 48*a*b*c*d*f*x)/(24*f)
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 276, normalized size of antiderivative = 1.27 \[ \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx=\frac {-6 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{3} b^{2} d^{2}-16 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a b \,d^{2}-16 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} b^{2} c d -12 \cos \left (f x +e \right ) \sin \left (f x +e \right ) a^{2} d^{2}-48 \cos \left (f x +e \right ) \sin \left (f x +e \right ) a b c d -12 \cos \left (f x +e \right ) \sin \left (f x +e \right ) b^{2} c^{2}-9 \cos \left (f x +e \right ) \sin \left (f x +e \right ) b^{2} d^{2}-48 \cos \left (f x +e \right ) a^{2} c d -48 \cos \left (f x +e \right ) a b \,c^{2}-32 \cos \left (f x +e \right ) a b \,d^{2}-32 \cos \left (f x +e \right ) b^{2} c d +24 a^{2} c^{2} f x +48 a^{2} c d +12 a^{2} d^{2} f x +48 a b \,c^{2}+48 a b c d f x +32 a b \,d^{2}+12 b^{2} c^{2} f x +32 b^{2} c d +9 b^{2} d^{2} f x}{24 f} \] Input:

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

Output:

( - 6*cos(e + f*x)*sin(e + f*x)**3*b**2*d**2 - 16*cos(e + f*x)*sin(e + f*x 
)**2*a*b*d**2 - 16*cos(e + f*x)*sin(e + f*x)**2*b**2*c*d - 12*cos(e + f*x) 
*sin(e + f*x)*a**2*d**2 - 48*cos(e + f*x)*sin(e + f*x)*a*b*c*d - 12*cos(e 
+ f*x)*sin(e + f*x)*b**2*c**2 - 9*cos(e + f*x)*sin(e + f*x)*b**2*d**2 - 48 
*cos(e + f*x)*a**2*c*d - 48*cos(e + f*x)*a*b*c**2 - 32*cos(e + f*x)*a*b*d* 
*2 - 32*cos(e + f*x)*b**2*c*d + 24*a**2*c**2*f*x + 48*a**2*c*d + 12*a**2*d 
**2*f*x + 48*a*b*c**2 + 48*a*b*c*d*f*x + 32*a*b*d**2 + 12*b**2*c**2*f*x + 
32*b**2*c*d + 9*b**2*d**2*f*x)/(24*f)