Integrand size = 23, antiderivative size = 99 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\frac {1}{2} a \left (2 c^2+2 c d+d^2\right ) x-\frac {2 a \left (c^2+3 c d+d^2\right ) \cos (e+f x)}{3 f}-\frac {a d (2 c+3 d) \cos (e+f x) \sin (e+f x)}{6 f}-\frac {a \cos (e+f x) (c+d \sin (e+f x))^2}{3 f} \] Output:
1/2*a*(2*c^2+2*c*d+d^2)*x-2/3*a*(c^2+3*c*d+d^2)*cos(f*x+e)/f-1/6*a*d*(2*c+ 3*d)*cos(f*x+e)*sin(f*x+e)/f-1/3*a*cos(f*x+e)*(c+d*sin(f*x+e))^2/f
Time = 0.61 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.90 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\frac {a \left (12 c^2 f x+12 c d f x+6 d^2 f x-3 \left (4 c^2+8 c d+3 d^2\right ) \cos (e+f x)+d^2 \cos (3 (e+f x))-6 c d \sin (2 (e+f x))-3 d^2 \sin (2 (e+f x))\right )}{12 f} \] Input:
Integrate[(a + a*Sin[e + f*x])*(c + d*Sin[e + f*x])^2,x]
Output:
(a*(12*c^2*f*x + 12*c*d*f*x + 6*d^2*f*x - 3*(4*c^2 + 8*c*d + 3*d^2)*Cos[e + f*x] + d^2*Cos[3*(e + f*x)] - 6*c*d*Sin[2*(e + f*x)] - 3*d^2*Sin[2*(e + f*x)]))/(12*f)
Time = 0.36 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.03, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {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 \sin (e+f x)+a) (c+d \sin (e+f x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a \sin (e+f x)+a) (c+d \sin (e+f x))^2dx\) |
\(\Big \downarrow \) 3232 |
\(\displaystyle \frac {1}{3} \int (c+d \sin (e+f x)) (a (3 c+2 d)+a (2 c+3 d) \sin (e+f x))dx-\frac {a \cos (e+f x) (c+d \sin (e+f x))^2}{3 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{3} \int (c+d \sin (e+f x)) (a (3 c+2 d)+a (2 c+3 d) \sin (e+f x))dx-\frac {a \cos (e+f x) (c+d \sin (e+f x))^2}{3 f}\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {1}{3} \left (-\frac {2 a \left (c^2+3 c d+d^2\right ) \cos (e+f x)}{f}+\frac {3}{2} a x \left (2 c^2+2 c d+d^2\right )-\frac {a d (2 c+3 d) \sin (e+f x) \cos (e+f x)}{2 f}\right )-\frac {a \cos (e+f x) (c+d \sin (e+f x))^2}{3 f}\) |
Input:
Int[(a + a*Sin[e + f*x])*(c + d*Sin[e + f*x])^2,x]
Output:
-1/3*(a*Cos[e + f*x]*(c + d*Sin[e + f*x])^2)/f + ((3*a*(2*c^2 + 2*c*d + d^ 2)*x)/2 - (2*a*(c^2 + 3*c*d + d^2)*Cos[e + f*x])/f - (a*d*(2*c + 3*d)*Cos[ e + f*x]*Sin[e + f*x])/(2*f))/3
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]
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]
Time = 0.42 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.16
\[\frac {-a \,c^{2} \cos \left (f x +e \right )+2 a c d \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {a \,d^{2} \left (2+\sin \left (f x +e \right )^{2}\right ) \cos \left (f x +e \right )}{3}+a \,c^{2} \left (f x +e \right )-2 a c d \cos \left (f x +e \right )+a \,d^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\]
Input:
int((a+sin(f*x+e)*a)*(c+d*sin(f*x+e))^2,x)
Output:
1/f*(-a*c^2*cos(f*x+e)+2*a*c*d*(-1/2*cos(f*x+e)*sin(f*x+e)+1/2*f*x+1/2*e)- 1/3*a*d^2*(2+sin(f*x+e)^2)*cos(f*x+e)+a*c^2*(f*x+e)-2*a*c*d*cos(f*x+e)+a*d ^2*(-1/2*cos(f*x+e)*sin(f*x+e)+1/2*f*x+1/2*e))
Time = 0.09 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.91 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\frac {2 \, a d^{2} \cos \left (f x + e\right )^{3} + 3 \, {\left (2 \, a c^{2} + 2 \, a c d + a d^{2}\right )} f x - 3 \, {\left (2 \, a c d + a d^{2}\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \, {\left (a c^{2} + 2 \, a c d + a d^{2}\right )} \cos \left (f x + e\right )}{6 \, f} \] Input:
integrate((a+a*sin(f*x+e))*(c+d*sin(f*x+e))^2,x, algorithm="fricas")
Output:
1/6*(2*a*d^2*cos(f*x + e)^3 + 3*(2*a*c^2 + 2*a*c*d + a*d^2)*f*x - 3*(2*a*c *d + a*d^2)*cos(f*x + e)*sin(f*x + e) - 6*(a*c^2 + 2*a*c*d + a*d^2)*cos(f* x + e))/f
Leaf count of result is larger than twice the leaf count of optimal. 199 vs. \(2 (94) = 188\).
Time = 0.14 (sec) , antiderivative size = 199, normalized size of antiderivative = 2.01 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\begin {cases} a c^{2} x - \frac {a c^{2} \cos {\left (e + f x \right )}}{f} + a c d x \sin ^{2}{\left (e + f x \right )} + a c d x \cos ^{2}{\left (e + f x \right )} - \frac {a c d \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {2 a c d \cos {\left (e + f x \right )}}{f} + \frac {a d^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a d^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {a d^{2} \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {a d^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 a d^{2} \cos ^{3}{\left (e + f x \right )}}{3 f} & \text {for}\: f \neq 0 \\x \left (c + d \sin {\left (e \right )}\right )^{2} \left (a \sin {\left (e \right )} + a\right ) & \text {otherwise} \end {cases} \] Input:
integrate((a+a*sin(f*x+e))*(c+d*sin(f*x+e))**2,x)
Output:
Piecewise((a*c**2*x - a*c**2*cos(e + f*x)/f + a*c*d*x*sin(e + f*x)**2 + a* c*d*x*cos(e + f*x)**2 - a*c*d*sin(e + f*x)*cos(e + f*x)/f - 2*a*c*d*cos(e + f*x)/f + a*d**2*x*sin(e + f*x)**2/2 + a*d**2*x*cos(e + f*x)**2/2 - a*d** 2*sin(e + f*x)**2*cos(e + f*x)/f - a*d**2*sin(e + f*x)*cos(e + f*x)/(2*f) - 2*a*d**2*cos(e + f*x)**3/(3*f), Ne(f, 0)), (x*(c + d*sin(e))**2*(a*sin(e ) + a), True))
Time = 0.03 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.13 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\frac {12 \, {\left (f x + e\right )} a c^{2} + 6 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a c d + 4 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} a d^{2} + 3 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a d^{2} - 12 \, a c^{2} \cos \left (f x + e\right ) - 24 \, a c d \cos \left (f x + e\right )}{12 \, f} \] Input:
integrate((a+a*sin(f*x+e))*(c+d*sin(f*x+e))^2,x, algorithm="maxima")
Output:
1/12*(12*(f*x + e)*a*c^2 + 6*(2*f*x + 2*e - sin(2*f*x + 2*e))*a*c*d + 4*(c os(f*x + e)^3 - 3*cos(f*x + e))*a*d^2 + 3*(2*f*x + 2*e - sin(2*f*x + 2*e)) *a*d^2 - 12*a*c^2*cos(f*x + e) - 24*a*c*d*cos(f*x + e))/f
Time = 0.13 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.13 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=a c d x + \frac {a d^{2} \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} - \frac {2 \, a c d \cos \left (f x + e\right )}{f} - \frac {a c d \sin \left (2 \, f x + 2 \, e\right )}{2 \, f} - \frac {a d^{2} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} + \frac {1}{2} \, {\left (2 \, a c^{2} + a d^{2}\right )} x - \frac {{\left (4 \, a c^{2} + 3 \, a d^{2}\right )} \cos \left (f x + e\right )}{4 \, f} \] Input:
integrate((a+a*sin(f*x+e))*(c+d*sin(f*x+e))^2,x, algorithm="giac")
Output:
a*c*d*x + 1/12*a*d^2*cos(3*f*x + 3*e)/f - 2*a*c*d*cos(f*x + e)/f - 1/2*a*c *d*sin(2*f*x + 2*e)/f - 1/4*a*d^2*sin(2*f*x + 2*e)/f + 1/2*(2*a*c^2 + a*d^ 2)*x - 1/4*(4*a*c^2 + 3*a*d^2)*cos(f*x + e)/f
Time = 16.58 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.09 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=-\frac {\frac {3\,a\,d^2\,\sin \left (2\,e+2\,f\,x\right )}{2}-\frac {a\,d^2\,\cos \left (3\,e+3\,f\,x\right )}{2}+6\,a\,c^2\,\cos \left (e+f\,x\right )+\frac {9\,a\,d^2\,\cos \left (e+f\,x\right )}{2}+3\,a\,c\,d\,\sin \left (2\,e+2\,f\,x\right )-6\,a\,c^2\,f\,x-3\,a\,d^2\,f\,x+12\,a\,c\,d\,\cos \left (e+f\,x\right )-6\,a\,c\,d\,f\,x}{6\,f} \] Input:
int((a + a*sin(e + f*x))*(c + d*sin(e + f*x))^2,x)
Output:
-((3*a*d^2*sin(2*e + 2*f*x))/2 - (a*d^2*cos(3*e + 3*f*x))/2 + 6*a*c^2*cos( e + f*x) + (9*a*d^2*cos(e + f*x))/2 + 3*a*c*d*sin(2*e + 2*f*x) - 6*a*c^2*f *x - 3*a*d^2*f*x + 12*a*c*d*cos(e + f*x) - 6*a*c*d*f*x)/(6*f)
Time = 0.19 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.26 \[ \int (a+a \sin (e+f x)) (c+d \sin (e+f x))^2 \, dx=\frac {a \left (-2 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} d^{2}-6 \cos \left (f x +e \right ) \sin \left (f x +e \right ) c d -3 \cos \left (f x +e \right ) \sin \left (f x +e \right ) d^{2}-6 \cos \left (f x +e \right ) c^{2}-12 \cos \left (f x +e \right ) c d -4 \cos \left (f x +e \right ) d^{2}+6 c^{2} f x +6 c^{2}+6 c d f x +12 c d +3 d^{2} f x +4 d^{2}\right )}{6 f} \] Input:
int((a+a*sin(f*x+e))*(c+d*sin(f*x+e))^2,x)
Output:
(a*( - 2*cos(e + f*x)*sin(e + f*x)**2*d**2 - 6*cos(e + f*x)*sin(e + f*x)*c *d - 3*cos(e + f*x)*sin(e + f*x)*d**2 - 6*cos(e + f*x)*c**2 - 12*cos(e + f *x)*c*d - 4*cos(e + f*x)*d**2 + 6*c**2*f*x + 6*c**2 + 6*c*d*f*x + 12*c*d + 3*d**2*f*x + 4*d**2))/(6*f)