Optimal. Leaf size=552 \[ -\frac {\sqrt {2} (c+d) \cos (e+f x) \left (a^2 c d^2 \left (n^2+7 n+12\right )-2 a b d (n+4) \left (2 c^2-d^2 (n+2)\right )+b^2 c \left (6 c^2-d^2 \left (-n^2-n+3\right )\right )\right ) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac {1}{2};\frac {1}{2},-n-1;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right )}{d^4 f (n+2) (n+3) (n+4) \sqrt {\sin (e+f x)+1}}-\frac {\sqrt {2} \left (c^2-d^2\right ) \cos (e+f x) \left (-a^2 d^2 \left (n^2+7 n+12\right )+4 a b c d (n+4)-\left (b^2 \left (6 c^2+d^2 \left (n^2+4 n+3\right )\right )\right )\right ) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac {1}{2};\frac {1}{2},-n;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right )}{d^4 f (n+2) (n+3) (n+4) \sqrt {\sin (e+f x)+1}}+\frac {\cos (e+f x) \left (2 a^2 d^2 (n+3)-4 a b c d (n+4)+b^2 \left (6 c^2-d^2 (n+3)\right )\right ) (c+d \sin (e+f x))^{n+1}}{d^3 f (n+2) (n+3) (n+4)}-\frac {b (3 b c-2 a d) \sin (e+f x) \cos (e+f x) (c+d \sin (e+f x))^{n+1}}{d^2 f (n+3) (n+4)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{n+1}}{d f (n+4)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 1.51, antiderivative size = 552, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 8, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.242, Rules used = {2922, 3050, 3033, 3023, 2756, 2665, 139, 138} \[ -\frac {\sqrt {2} (c+d) \cos (e+f x) \left (a^2 c d^2 \left (n^2+7 n+12\right )-2 a b d (n+4) \left (2 c^2-d^2 (n+2)\right )+b^2 \left (6 c^3-c d^2 \left (-n^2-n+3\right )\right )\right ) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac {1}{2};\frac {1}{2},-n-1;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right )}{d^4 f (n+2) (n+3) (n+4) \sqrt {\sin (e+f x)+1}}-\frac {\sqrt {2} \left (c^2-d^2\right ) \cos (e+f x) \left (-a^2 d^2 \left (n^2+7 n+12\right )+4 a b c d (n+4)+b^2 \left (-\left (6 c^2+d^2 \left (n^2+4 n+3\right )\right )\right )\right ) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac {1}{2};\frac {1}{2},-n;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right )}{d^4 f (n+2) (n+3) (n+4) \sqrt {\sin (e+f x)+1}}+\frac {\cos (e+f x) \left (2 a^2 d^2 (n+3)-4 a b c d (n+4)+b^2 \left (6 c^2-d^2 (n+3)\right )\right ) (c+d \sin (e+f x))^{n+1}}{d^3 f (n+2) (n+3) (n+4)}-\frac {b (3 b c-2 a d) \sin (e+f x) \cos (e+f x) (c+d \sin (e+f x))^{n+1}}{d^2 f (n+3) (n+4)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{n+1}}{d f (n+4)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 138
Rule 139
Rule 2665
Rule 2756
Rule 2922
Rule 3023
Rule 3033
Rule 3050
Rubi steps
\begin {align*} \int \cos ^2(e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^n \, dx &=\int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^n \left (1-\sin ^2(e+f x)\right ) \, dx\\ &=\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}+\frac {\int (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \left (-2 b c+3 a d+(a c+b d) \sin (e+f x)+(3 b c-2 a d) \sin ^2(e+f x)\right ) \, dx}{d (4+n)}\\ &=-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}+\frac {\int (c+d \sin (e+f x))^n \left (3 b^2 c^2+3 a^2 d^2 (3+n)-2 a b c d (4+n)+d \left (b^2 c n+a^2 c (3+n)+2 a b d (4+n)\right ) \sin (e+f x)-\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \sin ^2(e+f x)\right ) \, dx}{d^2 (3+n) (4+n)}\\ &=\frac {\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^3 f (2+n) (3+n) (4+n)}-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}+\frac {\int (c+d \sin (e+f x))^n \left (d \left (2 a b c d n (4+n)+a^2 d^2 \left (12+7 n+n^2\right )-b^2 \left (3 c^2 n-d^2 \left (3+4 n+n^2\right )\right )\right )+\left (a^2 c d^2 \left (12+7 n+n^2\right )-2 a b d (4+n) \left (2 c^2-d^2 (2+n)\right )+b^2 \left (6 c^3-c d^2 \left (3-n-n^2\right )\right )\right ) \sin (e+f x)\right ) \, dx}{d^3 (2+n) (3+n) (4+n)}\\ &=\frac {\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^3 f (2+n) (3+n) (4+n)}-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}+\frac {\left (a^2 c d^2 \left (12+7 n+n^2\right )-2 a b d (4+n) \left (2 c^2-d^2 (2+n)\right )+b^2 \left (6 c^3-c d^2 \left (3-n-n^2\right )\right )\right ) \int (c+d \sin (e+f x))^{1+n} \, dx}{d^4 (2+n) (3+n) (4+n)}+\frac {\left (\left (c^2-d^2\right ) \left (4 a b c d (4+n)-a^2 d^2 \left (12+7 n+n^2\right )-b^2 \left (6 c^2+d^2 \left (3+4 n+n^2\right )\right )\right )\right ) \int (c+d \sin (e+f x))^n \, dx}{d^4 (2+n) (3+n) (4+n)}\\ &=\frac {\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^3 f (2+n) (3+n) (4+n)}-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}+\frac {\left (\left (a^2 c d^2 \left (12+7 n+n^2\right )-2 a b d (4+n) \left (2 c^2-d^2 (2+n)\right )+b^2 \left (6 c^3-c d^2 \left (3-n-n^2\right )\right )\right ) \cos (e+f x)\right ) \operatorname {Subst}\left (\int \frac {(c+d x)^{1+n}}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sin (e+f x)\right )}{d^4 f (2+n) (3+n) (4+n) \sqrt {1-\sin (e+f x)} \sqrt {1+\sin (e+f x)}}+\frac {\left (\left (c^2-d^2\right ) \left (4 a b c d (4+n)-a^2 d^2 \left (12+7 n+n^2\right )-b^2 \left (6 c^2+d^2 \left (3+4 n+n^2\right )\right )\right ) \cos (e+f x)\right ) \operatorname {Subst}\left (\int \frac {(c+d x)^n}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sin (e+f x)\right )}{d^4 f (2+n) (3+n) (4+n) \sqrt {1-\sin (e+f x)} \sqrt {1+\sin (e+f x)}}\\ &=\frac {\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^3 f (2+n) (3+n) (4+n)}-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}-\frac {\left ((-c-d) \left (a^2 c d^2 \left (12+7 n+n^2\right )-2 a b d (4+n) \left (2 c^2-d^2 (2+n)\right )+b^2 \left (6 c^3-c d^2 \left (3-n-n^2\right )\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (-\frac {c+d \sin (e+f x)}{-c-d}\right )^{-n}\right ) \operatorname {Subst}\left (\int \frac {\left (-\frac {c}{-c-d}-\frac {d x}{-c-d}\right )^{1+n}}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sin (e+f x)\right )}{d^4 f (2+n) (3+n) (4+n) \sqrt {1-\sin (e+f x)} \sqrt {1+\sin (e+f x)}}+\frac {\left (\left (c^2-d^2\right ) \left (4 a b c d (4+n)-a^2 d^2 \left (12+7 n+n^2\right )-b^2 \left (6 c^2+d^2 \left (3+4 n+n^2\right )\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (-\frac {c+d \sin (e+f x)}{-c-d}\right )^{-n}\right ) \operatorname {Subst}\left (\int \frac {\left (-\frac {c}{-c-d}-\frac {d x}{-c-d}\right )^n}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sin (e+f x)\right )}{d^4 f (2+n) (3+n) (4+n) \sqrt {1-\sin (e+f x)} \sqrt {1+\sin (e+f x)}}\\ &=\frac {\left (2 a^2 d^2 (3+n)-4 a b c d (4+n)+b^2 \left (6 c^2-d^2 (3+n)\right )\right ) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^3 f (2+n) (3+n) (4+n)}-\frac {b (3 b c-2 a d) \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (3+n) (4+n)}+\frac {\cos (e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^{1+n}}{d f (4+n)}-\frac {\sqrt {2} (c+d) \left (a^2 c d^2 \left (12+7 n+n^2\right )-2 a b d (4+n) \left (2 c^2-d^2 (2+n)\right )+b^2 \left (6 c^3-c d^2 \left (3-n-n^2\right )\right )\right ) F_1\left (\frac {1}{2};\frac {1}{2},-1-n;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n}}{d^4 f (2+n) (3+n) (4+n) \sqrt {1+\sin (e+f x)}}-\frac {\sqrt {2} \left (c^2-d^2\right ) \left (4 a b c d (4+n)-a^2 d^2 \left (12+7 n+n^2\right )-b^2 \left (6 c^2+d^2 \left (3+4 n+n^2\right )\right )\right ) F_1\left (\frac {1}{2};\frac {1}{2},-n;\frac {3}{2};\frac {1}{2} (1-\sin (e+f x)),\frac {d (1-\sin (e+f x))}{c+d}\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-n}}{d^4 f (2+n) (3+n) (4+n) \sqrt {1+\sin (e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [F] time = 8.85, size = 0, normalized size = 0.00 \[ \int \cos ^2(e+f x) (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^n \, dx \]
Verification is Not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.56, size = 0, normalized size = 0.00 \[ {\rm integral}\left (-{\left (b^{2} \cos \left (f x + e\right )^{4} - 2 \, a b \cos \left (f x + e\right )^{2} \sin \left (f x + e\right ) - {\left (a^{2} + b^{2}\right )} \cos \left (f x + e\right )^{2}\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{n}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sin \left (f x + e\right ) + a\right )}^{2} {\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 3.25, size = 0, normalized size = 0.00 \[ \int \left (\cos ^{2}\left (f x +e \right )\right ) \left (a +b \sin \left (f x +e \right )\right )^{2} \left (c +d \sin \left (f x +e \right )\right )^{n}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sin \left (f x + e\right ) + a\right )}^{2} {\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.00 \[ \int {\cos \left (e+f\,x\right )}^2\,{\left (a+b\,\sin \left (e+f\,x\right )\right )}^2\,{\left (c+d\,\sin \left (e+f\,x\right )\right )}^n \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________