\(\int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx\) [1015]

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

Optimal result

Integrand size = 33, antiderivative size = 167 \[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=-\frac {B (g \cos (e+f x))^{1+p} (a+a \sin (e+f x))^m}{f g (1+m+p)}-\frac {2^{\frac {1}{2} (1+2 m+p)} (B m+A (1+m+p)) (g \cos (e+f x))^{1+p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2} (1-2 m-p),\frac {1+p}{2},\frac {3+p}{2},\frac {1}{2} (1-\sin (e+f x))\right ) (1+\sin (e+f x))^{\frac {1}{2} (-1-2 m-p)} (a+a \sin (e+f x))^m}{f g (1+p) (1+m+p)} \] Output:

-B*(g*cos(f*x+e))^(p+1)*(a+a*sin(f*x+e))^m/f/g/(1+m+p)-2^(1/2+m+1/2*p)*(B* 
m+A*(1+m+p))*(g*cos(f*x+e))^(p+1)*hypergeom([1/2*p+1/2, 1/2-m-1/2*p],[3/2+ 
1/2*p],1/2-1/2*sin(f*x+e))*(1+sin(f*x+e))^(-1/2-m-1/2*p)*(a+a*sin(f*x+e))^ 
m/f/g/(p+1)/(1+m+p)
 

Mathematica [A] (verified)

Time = 0.56 (sec) , antiderivative size = 154, normalized size of antiderivative = 0.92 \[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=-\frac {\cos (e+f x) (g \cos (e+f x))^p (1+\sin (e+f x))^{\frac {1}{2} (-1-2 m-p)} (a (1+\sin (e+f x)))^m \left (2^{\frac {1}{2} (1+2 m+p)} (B m+A (1+m+p)) \operatorname {Hypergeometric2F1}\left (\frac {1}{2} (1-2 m-p),\frac {1+p}{2},\frac {3+p}{2},\frac {1}{2} (1-\sin (e+f x))\right )+B (1+p) (1+\sin (e+f x))^{\frac {1}{2} (1+2 m+p)}\right )}{f (1+p) (1+m+p)} \] Input:

Integrate[(g*Cos[e + f*x])^p*(a + a*Sin[e + f*x])^m*(A + B*Sin[e + f*x]),x 
]
 

Output:

-((Cos[e + f*x]*(g*Cos[e + f*x])^p*(1 + Sin[e + f*x])^((-1 - 2*m - p)/2)*( 
a*(1 + Sin[e + f*x]))^m*(2^((1 + 2*m + p)/2)*(B*m + A*(1 + m + p))*Hyperge 
ometric2F1[(1 - 2*m - p)/2, (1 + p)/2, (3 + p)/2, (1 - Sin[e + f*x])/2] + 
B*(1 + p)*(1 + Sin[e + f*x])^((1 + 2*m + p)/2)))/(f*(1 + p)*(1 + m + p)))
 

Rubi [A] (verified)

Time = 0.57 (sec) , antiderivative size = 213, normalized size of antiderivative = 1.28, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3042, 3339, 3042, 3168, 80, 79}

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)^m (A+B \sin (e+f x)) (g \cos (e+f x))^p \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a \sin (e+f x)+a)^m (A+B \sin (e+f x)) (g \cos (e+f x))^pdx\)

\(\Big \downarrow \) 3339

\(\displaystyle \left (A+\frac {B m}{m+p+1}\right ) \int (g \cos (e+f x))^p (\sin (e+f x) a+a)^mdx-\frac {B (a \sin (e+f x)+a)^m (g \cos (e+f x))^{p+1}}{f g (m+p+1)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (A+\frac {B m}{m+p+1}\right ) \int (g \cos (e+f x))^p (\sin (e+f x) a+a)^mdx-\frac {B (a \sin (e+f x)+a)^m (g \cos (e+f x))^{p+1}}{f g (m+p+1)}\)

\(\Big \downarrow \) 3168

\(\displaystyle \frac {a^2 \left (A+\frac {B m}{m+p+1}\right ) (a-a \sin (e+f x))^{\frac {1}{2} (-p-1)} (a \sin (e+f x)+a)^{\frac {1}{2} (-p-1)} (g \cos (e+f x))^{p+1} \int (a-a \sin (e+f x))^{\frac {p-1}{2}} (\sin (e+f x) a+a)^{m+\frac {p-1}{2}}d\sin (e+f x)}{f g}-\frac {B (a \sin (e+f x)+a)^m (g \cos (e+f x))^{p+1}}{f g (m+p+1)}\)

\(\Big \downarrow \) 80

\(\displaystyle \frac {a^2 2^{\frac {1}{2} (2 m+p-1)} \left (A+\frac {B m}{m+p+1}\right ) (a-a \sin (e+f x))^{\frac {1}{2} (-p-1)} (g \cos (e+f x))^{p+1} (\sin (e+f x)+1)^{\frac {1}{2} (-2 m-p+1)} (a \sin (e+f x)+a)^{\frac {1}{2} (2 m+p-1)+\frac {1}{2} (-p-1)} \int \left (\frac {1}{2} \sin (e+f x)+\frac {1}{2}\right )^{m+\frac {p-1}{2}} (a-a \sin (e+f x))^{\frac {p-1}{2}}d\sin (e+f x)}{f g}-\frac {B (a \sin (e+f x)+a)^m (g \cos (e+f x))^{p+1}}{f g (m+p+1)}\)

\(\Big \downarrow \) 79

\(\displaystyle -\frac {a 2^{\frac {1}{2} (2 m+p-1)+1} \left (A+\frac {B m}{m+p+1}\right ) (a-a \sin (e+f x))^{\frac {1}{2} (-p-1)+\frac {p+1}{2}} (g \cos (e+f x))^{p+1} (\sin (e+f x)+1)^{\frac {1}{2} (-2 m-p+1)} (a \sin (e+f x)+a)^{\frac {1}{2} (2 m+p-1)+\frac {1}{2} (-p-1)} \operatorname {Hypergeometric2F1}\left (\frac {1}{2} (-2 m-p+1),\frac {p+1}{2},\frac {p+3}{2},\frac {1}{2} (1-\sin (e+f x))\right )}{f g (p+1)}-\frac {B (a \sin (e+f x)+a)^m (g \cos (e+f x))^{p+1}}{f g (m+p+1)}\)

Input:

Int[(g*Cos[e + f*x])^p*(a + a*Sin[e + f*x])^m*(A + B*Sin[e + f*x]),x]
 

Output:

-((B*(g*Cos[e + f*x])^(1 + p)*(a + a*Sin[e + f*x])^m)/(f*g*(1 + m + p))) - 
 (2^(1 + (-1 + 2*m + p)/2)*a*(A + (B*m)/(1 + m + p))*(g*Cos[e + f*x])^(1 + 
 p)*Hypergeometric2F1[(1 - 2*m - p)/2, (1 + p)/2, (3 + p)/2, (1 - Sin[e + 
f*x])/2]*(1 + Sin[e + f*x])^((1 - 2*m - p)/2)*(a - a*Sin[e + f*x])^((-1 - 
p)/2 + (1 + p)/2)*(a + a*Sin[e + f*x])^((-1 - p)/2 + (-1 + 2*m + p)/2))/(f 
*g*(1 + p))
 

Defintions of rubi rules used

rule 79
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(( 
a + b*x)^(m + 1)/(b*(m + 1)*(b/(b*c - a*d))^n))*Hypergeometric2F1[-n, m + 1 
, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m, n}, x] 
&&  !IntegerQ[m] &&  !IntegerQ[n] && GtQ[b/(b*c - a*d), 0] && (RationalQ[m] 
 ||  !(RationalQ[n] && GtQ[-d/(b*c - a*d), 0]))
 

rule 80
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(c 
 + d*x)^FracPart[n]/((b/(b*c - a*d))^IntPart[n]*(b*((c + d*x)/(b*c - a*d))) 
^FracPart[n])   Int[(a + b*x)^m*Simp[b*(c/(b*c - a*d)) + b*d*(x/(b*c - a*d) 
), x]^n, x], x] /; FreeQ[{a, b, c, d, m, n}, x] &&  !IntegerQ[m] &&  !Integ 
erQ[n] && (RationalQ[m] ||  !SimplerQ[n + 1, m + 1])
 

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

rule 3168
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_.), x_Symbol] :> Simp[a^2*((g*Cos[e + f*x])^(p + 1)/(f*g*(a + b*Sin 
[e + f*x])^((p + 1)/2)*(a - b*Sin[e + f*x])^((p + 1)/2)))   Subst[Int[(a + 
b*x)^(m + (p - 1)/2)*(a - b*x)^((p - 1)/2), x], x, Sin[e + f*x]], x] /; Fre 
eQ[{a, b, e, f, g, m, p}, x] && EqQ[a^2 - b^2, 0] &&  !IntegerQ[m]
 

rule 3339
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d)* 
(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^m/(f*g*(m + p + 1))), x] + S 
imp[(a*d*m + b*c*(m + p + 1))/(b*(m + p + 1))   Int[(g*Cos[e + f*x])^p*(a + 
 b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] && EqQ[ 
a^2 - b^2, 0] && NeQ[m + p + 1, 0]
 
Maple [F]

\[\int \left (g \cos \left (f x +e \right )\right )^{p} \left (a +a \sin \left (f x +e \right )\right )^{m} \left (A +B \sin \left (f x +e \right )\right )d x\]

Input:

int((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x)
 

Output:

int((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x)
 

Fricas [F]

\[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=\int { {\left (B \sin \left (f x + e\right ) + A\right )} \left (g \cos \left (f x + e\right )\right )^{p} {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \,d x } \] Input:

integrate((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x, algorith 
m="fricas")
 

Output:

integral((B*sin(f*x + e) + A)*(g*cos(f*x + e))^p*(a*sin(f*x + e) + a)^m, x 
)
 

Sympy [F]

\[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=\int \left (a \left (\sin {\left (e + f x \right )} + 1\right )\right )^{m} \left (g \cos {\left (e + f x \right )}\right )^{p} \left (A + B \sin {\left (e + f x \right )}\right )\, dx \] Input:

integrate((g*cos(f*x+e))**p*(a+a*sin(f*x+e))**m*(A+B*sin(f*x+e)),x)
 

Output:

Integral((a*(sin(e + f*x) + 1))**m*(g*cos(e + f*x))**p*(A + B*sin(e + f*x) 
), x)
 

Maxima [F]

\[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=\int { {\left (B \sin \left (f x + e\right ) + A\right )} \left (g \cos \left (f x + e\right )\right )^{p} {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \,d x } \] Input:

integrate((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x, algorith 
m="maxima")
 

Output:

integrate((B*sin(f*x + e) + A)*(g*cos(f*x + e))^p*(a*sin(f*x + e) + a)^m, 
x)
 

Giac [F]

\[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=\int { {\left (B \sin \left (f x + e\right ) + A\right )} \left (g \cos \left (f x + e\right )\right )^{p} {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \,d x } \] Input:

integrate((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x, algorith 
m="giac")
 

Output:

integrate((B*sin(f*x + e) + A)*(g*cos(f*x + e))^p*(a*sin(f*x + e) + a)^m, 
x)
 

Mupad [F(-1)]

Timed out. \[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=\int {\left (g\,\cos \left (e+f\,x\right )\right )}^p\,\left (A+B\,\sin \left (e+f\,x\right )\right )\,{\left (a+a\,\sin \left (e+f\,x\right )\right )}^m \,d x \] Input:

int((g*cos(e + f*x))^p*(A + B*sin(e + f*x))*(a + a*sin(e + f*x))^m,x)
 

Output:

int((g*cos(e + f*x))^p*(A + B*sin(e + f*x))*(a + a*sin(e + f*x))^m, x)
 

Reduce [F]

\[ \int (g \cos (e+f x))^p (a+a \sin (e+f x))^m (A+B \sin (e+f x)) \, dx=g^{p} \left (\left (\int \left (a +a \sin \left (f x +e \right )\right )^{m} \cos \left (f x +e \right )^{p} \sin \left (f x +e \right )d x \right ) b +\left (\int \left (a +a \sin \left (f x +e \right )\right )^{m} \cos \left (f x +e \right )^{p}d x \right ) a \right ) \] Input:

int((g*cos(f*x+e))^p*(a+a*sin(f*x+e))^m*(A+B*sin(f*x+e)),x)
 

Output:

g**p*(int((sin(e + f*x)*a + a)**m*cos(e + f*x)**p*sin(e + f*x),x)*b + int( 
(sin(e + f*x)*a + a)**m*cos(e + f*x)**p,x)*a)