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

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

Optimal result

Integrand size = 31, antiderivative size = 376 \[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=-\frac {(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac {b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}-\frac {\sqrt {2} \left (a c d (3+n)-b \left (2 c^2-d^2 (2+n)\right )\right ) \operatorname {AppellF1}\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))^{1+n} \left (\frac {c+d \sin (e+f x)}{c+d}\right )^{-1-n}}{d^3 f (2+n) (3+n) \sqrt {1+\sin (e+f x)}}-\frac {\sqrt {2} \left (c^2-d^2\right ) (2 b c-a d (3+n)) \operatorname {AppellF1}\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^3 f (2+n) (3+n) \sqrt {1+\sin (e+f x)}} \] Output:

-(2*b*c-a*d*(3+n))*cos(f*x+e)*(c+d*sin(f*x+e))^(1+n)/d^2/f/(2+n)/(3+n)+b*c 
os(f*x+e)*sin(f*x+e)*(c+d*sin(f*x+e))^(1+n)/d/f/(3+n)-2^(1/2)*(a*c*d*(3+n) 
-b*(2*c^2-d^2*(2+n)))*AppellF1(1/2,-1-n,1/2,3/2,d*(1-sin(f*x+e))/(c+d),1/2 
-1/2*sin(f*x+e))*cos(f*x+e)*(c+d*sin(f*x+e))^(1+n)*((c+d*sin(f*x+e))/(c+d) 
)^(-1-n)/d^3/f/(2+n)/(3+n)/(1+sin(f*x+e))^(1/2)-2^(1/2)*(c^2-d^2)*(2*b*c-a 
*d*(3+n))*AppellF1(1/2,-n,1/2,3/2,d*(1-sin(f*x+e))/(c+d),1/2-1/2*sin(f*x+e 
))*cos(f*x+e)*(c+d*sin(f*x+e))^n/d^3/f/(2+n)/(3+n)/(1+sin(f*x+e))^(1/2)/(( 
(c+d*sin(f*x+e))/(c+d))^n)
 

Mathematica [F]

\[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 1.16 (sec) , antiderivative size = 369, normalized size of antiderivative = 0.98, number of steps used = 15, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.452, Rules used = {3042, 3401, 3042, 3513, 25, 3042, 3502, 25, 3042, 3235, 3042, 3144, 156, 155}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3401

\(\displaystyle \int \left (1-\sin ^2(e+f x)\right ) (a+b \sin (e+f x)) (c+d \sin (e+f x))^ndx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (1-\sin (e+f x)^2\right ) (a+b \sin (e+f x)) (c+d \sin (e+f x))^ndx\)

\(\Big \downarrow \) 3513

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3235

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3144

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

\(\Big \downarrow \) 156

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

\(\Big \downarrow \) 155

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

Input:

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

Output:

(b*Cos[e + f*x]*Sin[e + f*x]*(c + d*Sin[e + f*x])^(1 + n))/(d*f*(3 + n)) - 
 (((2*b*c - a*d*(3 + n))*Cos[e + f*x]*(c + d*Sin[e + f*x])^(1 + n))/(d*f*( 
2 + n)) - ((Sqrt[2]*(c + d)*(2*b*c^2 - b*d^2*(2 + n) - a*c*d*(3 + n))*Appe 
llF1[1/2, 1/2, -1 - n, 3/2, (1 - Sin[e + f*x])/2, (d*(1 - Sin[e + f*x]))/( 
c + d)]*Cos[e + f*x]*(c + d*Sin[e + f*x])^n)/(d*f*Sqrt[1 + Sin[e + f*x]]*( 
(c + d*Sin[e + f*x])/(c + d))^n) - (Sqrt[2]*(c^2 - d^2)*(2*b*c - a*d*(3 + 
n))*AppellF1[1/2, 1/2, -n, 3/2, (1 - Sin[e + f*x])/2, (d*(1 - Sin[e + f*x] 
))/(c + d)]*Cos[e + f*x]*(c + d*Sin[e + f*x])^n)/(d*f*Sqrt[1 + Sin[e + f*x 
]]*((c + d*Sin[e + f*x])/(c + d))^n))/(d*(2 + n)))/(d*(3 + n))
 

Defintions of rubi rules used

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

rule 155
Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_)) 
^(p_), x_] :> Simp[((a + b*x)^(m + 1)/(b*(m + 1)*Simplify[b/(b*c - a*d)]^n* 
Simplify[b/(b*e - a*f)]^p))*AppellF1[m + 1, -n, -p, m + 2, (-d)*((a + b*x)/ 
(b*c - a*d)), (-f)*((a + b*x)/(b*e - a*f))], x] /; FreeQ[{a, b, c, d, e, f, 
 m, n, p}, x] &&  !IntegerQ[m] &&  !IntegerQ[n] &&  !IntegerQ[p] && GtQ[Sim 
plify[b/(b*c - a*d)], 0] && GtQ[Simplify[b/(b*e - a*f)], 0] &&  !(GtQ[Simpl 
ify[d/(d*a - c*b)], 0] && GtQ[Simplify[d/(d*e - c*f)], 0] && SimplerQ[c + d 
*x, a + b*x]) &&  !(GtQ[Simplify[f/(f*a - e*b)], 0] && GtQ[Simplify[f/(f*c 
- e*d)], 0] && SimplerQ[e + f*x, a + b*x])
 

rule 156
Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_)) 
^(p_), x_] :> Simp[(e + f*x)^FracPart[p]/(Simplify[b/(b*e - a*f)]^IntPart[p 
]*(b*((e + f*x)/(b*e - a*f)))^FracPart[p])   Int[(a + b*x)^m*(c + d*x)^n*Si 
mp[b*(e/(b*e - a*f)) + b*f*(x/(b*e - a*f)), x]^p, x], x] /; FreeQ[{a, b, c, 
 d, e, f, m, n, p}, x] &&  !IntegerQ[m] &&  !IntegerQ[n] &&  !IntegerQ[p] & 
& GtQ[Simplify[b/(b*c - a*d)], 0] &&  !GtQ[Simplify[b/(b*e - a*f)], 0]
 

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

rule 3144
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + 
d*x]/(d*Sqrt[1 + Sin[c + d*x]]*Sqrt[1 - Sin[c + d*x]])   Subst[Int[(a + b*x 
)^n/(Sqrt[1 + x]*Sqrt[1 - x]), x], x, Sin[c + d*x]], x] /; FreeQ[{a, b, c, 
d, n}, x] && NeQ[a^2 - b^2, 0] &&  !IntegerQ[2*n]
 

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

rule 3401
Int[cos[(e_.) + (f_.)*(x_)]^2*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)* 
((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Int[(a + b*Sin[e 
+ f*x])^m*(c + d*Sin[e + f*x])^n*(1 - Sin[e + f*x]^2), x] /; FreeQ[{a, b, c 
, d, e, f, m, n}, x] && NeQ[a^2 - b^2, 0] && (IGtQ[m, 0] || IntegersQ[2*m, 
2*n])
 

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]
 

rule 3513
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + 
 (f_.)*(x_)])*((A_.) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[ 
(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 3) 
)), x] + Simp[1/(b*(m + 3))   Int[(a + b*Sin[e + f*x])^m*Simp[a*C*d + A*b*c 
*(m + 3) + b*d*(C*(m + 2) + A*(m + 3))*Sin[e + f*x] - (2*a*C*d - b*c*C*(m + 
 3))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, m}, x] && 
 NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] &&  !LtQ[m, -1]
 
Maple [F]

\[\int \cos \left (f x +e \right )^{2} \left (a +b \sin \left (f x +e \right )\right ) \left (c +d \sin \left (f x +e \right )\right )^{n}d x\]

Input:

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

Output:

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

Fricas [F]

\[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\int { {\left (b \sin \left (f x + e\right ) + a\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2} \,d x } \] Input:

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

Output:

integral((b*cos(f*x + e)^2*sin(f*x + e) + a*cos(f*x + e)^2)*(d*sin(f*x + e 
) + c)^n, x)
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F]

\[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\int { {\left (b \sin \left (f x + e\right ) + a\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2} \,d x } \] Input:

integrate(cos(f*x+e)^2*(a+b*sin(f*x+e))*(c+d*sin(f*x+e))^n,x, algorithm="m 
axima")
                                                                                    
                                                                                    
 

Output:

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

Giac [F]

\[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\int { {\left (b \sin \left (f x + e\right ) + a\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2} \,d x } \] Input:

integrate(cos(f*x+e)^2*(a+b*sin(f*x+e))*(c+d*sin(f*x+e))^n,x, algorithm="g 
iac")
 

Output:

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

Mupad [F(-1)]

Timed out. \[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\int {\cos \left (e+f\,x\right )}^2\,\left (a+b\,\sin \left (e+f\,x\right )\right )\,{\left (c+d\,\sin \left (e+f\,x\right )\right )}^n \,d x \] Input:

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

Output:

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

Reduce [F]

\[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx=\left (\int \left (\sin \left (f x +e \right ) d +c \right )^{n} \cos \left (f x +e \right )^{2} \sin \left (f x +e \right )d x \right ) b +\left (\int \left (\sin \left (f x +e \right ) d +c \right )^{n} \cos \left (f x +e \right )^{2}d x \right ) a \] Input:

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

Output:

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