\(\int (a+a \sin (e+f x))^2 (g \tan (e+f x))^p \, dx\) [124]

Optimal result
Mathematica [C] (warning: unable to verify)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 23, antiderivative size = 187 \[ \int (a+a \sin (e+f x))^2 (g \tan (e+f x))^p \, dx=\frac {a^2 \operatorname {Hypergeometric2F1}\left (1,\frac {1+p}{2},\frac {3+p}{2},-\tan ^2(e+f x)\right ) (g \tan (e+f x))^{1+p}}{f g (1+p)}+\frac {2 a^2 \cos ^2(e+f x)^{\frac {1+p}{2}} \operatorname {Hypergeometric2F1}\left (\frac {1+p}{2},\frac {2+p}{2},\frac {4+p}{2},\sin ^2(e+f x)\right ) \sin (e+f x) (g \tan (e+f x))^{1+p}}{f g (2+p)}+\frac {a^2 \operatorname {Hypergeometric2F1}\left (2,\frac {3+p}{2},\frac {5+p}{2},-\tan ^2(e+f x)\right ) (g \tan (e+f x))^{3+p}}{f g^3 (3+p)} \] Output:

a^2*hypergeom([1, 1/2*p+1/2],[3/2+1/2*p],-tan(f*x+e)^2)*(g*tan(f*x+e))^(p+ 
1)/f/g/(p+1)+2*a^2*(cos(f*x+e)^2)^(1/2*p+1/2)*hypergeom([1+1/2*p, 1/2*p+1/ 
2],[2+1/2*p],sin(f*x+e)^2)*sin(f*x+e)*(g*tan(f*x+e))^(p+1)/f/g/(2+p)+a^2*h 
ypergeom([2, 3/2+1/2*p],[5/2+1/2*p],-tan(f*x+e)^2)*(g*tan(f*x+e))^(3+p)/f/ 
g^3/(3+p)
 

Mathematica [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 6 vs. order 5 in optimal.

Time = 16.83 (sec) , antiderivative size = 2054, normalized size of antiderivative = 10.98 \[ \int (a+a \sin (e+f x))^2 (g \tan (e+f x))^p \, dx=\text {Result too large to show} \] Input:

Integrate[(a + a*Sin[e + f*x])^2*(g*Tan[e + f*x])^p,x]
 

Output:

(2*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*(a + a*Sin[e + f*x])^2*Tan[(e + f*x 
)/2]*((2 + p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[(e + f*x)/2]^2, -Ta 
n[(e + f*x)/2]^2] + 4*(2 + p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e 
+ f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 4*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 
 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*(1 + p)*AppellF1[1 + 
 p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x 
)/2])*(g*Tan[e + f*x])^p*(Cos[(e + f*x)/2]^4*Tan[e + f*x]^p + 4*Cos[(e + f 
*x)/2]^3*Sin[(e + f*x)/2]*Tan[e + f*x]^p + 6*Cos[(e + f*x)/2]^2*Sin[(e + f 
*x)/2]^2*Tan[e + f*x]^p + 4*Cos[(e + f*x)/2]*Sin[(e + f*x)/2]^3*Tan[e + f* 
x]^p + Sin[(e + f*x)/2]^4*Tan[e + f*x]^p))/(f*(1 + p)*(2 + p)*(Cos[(e + f* 
x)/2] + Sin[(e + f*x)/2])^4*((2*p*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*Sec[ 
e + f*x]^2*Tan[(e + f*x)/2]*((2 + p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, 
Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*(2 + p)*AppellF1[(1 + p)/2, p 
, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 4*(2 + p)*Appel 
lF1[(1 + p)/2, p, 3, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 
 4*(1 + p)*AppellF1[1 + p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + 
f*x)/2]^2]*Tan[(e + f*x)/2])*Tan[e + f*x]^(-1 + p))/((1 + p)*(2 + p)) + (S 
ec[(e + f*x)/2]^2*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*((2 + p)*AppellF1[(1 
 + p)/2, p, 1, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*(2 
+ p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e +...
 

Rubi [A] (verified)

Time = 0.49 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3042, 3189, 2009}

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)^2 (g \tan (e+f x))^p \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a \sin (e+f x)+a)^2 (g \tan (e+f x))^pdx\)

\(\Big \downarrow \) 3189

\(\displaystyle \int \left (a^2 (g \tan (e+f x))^p+a^2 \sin ^2(e+f x) (g \tan (e+f x))^p+2 a^2 \sin (e+f x) (g \tan (e+f x))^p\right )dx\)

\(\Big \downarrow \) 2009

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

Input:

Int[(a + a*Sin[e + f*x])^2*(g*Tan[e + f*x])^p,x]
 

Output:

(a^2*Hypergeometric2F1[1, (1 + p)/2, (3 + p)/2, -Tan[e + f*x]^2]*(g*Tan[e 
+ f*x])^(1 + p))/(f*g*(1 + p)) + (2*a^2*(Cos[e + f*x]^2)^((1 + p)/2)*Hyper 
geometric2F1[(1 + p)/2, (2 + p)/2, (4 + p)/2, Sin[e + f*x]^2]*Sin[e + f*x] 
*(g*Tan[e + f*x])^(1 + p))/(f*g*(2 + p)) + (a^2*Hypergeometric2F1[2, (3 + 
p)/2, (5 + p)/2, -Tan[e + f*x]^2]*(g*Tan[e + f*x])^(3 + p))/(f*g^3*(3 + p) 
)
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 3189
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*( 
x_)])^(p_.), x_Symbol] :> Int[ExpandIntegrand[(g*Tan[e + f*x])^p, (a + b*Si 
n[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] 
&& IGtQ[m, 0]
 
Maple [F]

\[\int \left (a +\sin \left (f x +e \right ) a \right )^{2} \left (g \tan \left (f x +e \right )\right )^{p}d x\]

Input:

int((a+sin(f*x+e)*a)^2*(g*tan(f*x+e))^p,x)
 

Output:

int((a+sin(f*x+e)*a)^2*(g*tan(f*x+e))^p,x)
 

Fricas [F]

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

integrate((a+a*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="fricas")
 

Output:

integral(-(a^2*cos(f*x + e)^2 - 2*a^2*sin(f*x + e) - 2*a^2)*(g*tan(f*x + e 
))^p, x)
 

Sympy [F]

\[ \int (a+a \sin (e+f x))^2 (g \tan (e+f x))^p \, dx=a^{2} \left (\int \left (g \tan {\left (e + f x \right )}\right )^{p}\, dx + \int 2 \left (g \tan {\left (e + f x \right )}\right )^{p} \sin {\left (e + f x \right )}\, dx + \int \left (g \tan {\left (e + f x \right )}\right )^{p} \sin ^{2}{\left (e + f x \right )}\, dx\right ) \] Input:

integrate((a+a*sin(f*x+e))**2*(g*tan(f*x+e))**p,x)
 

Output:

a**2*(Integral((g*tan(e + f*x))**p, x) + Integral(2*(g*tan(e + f*x))**p*si 
n(e + f*x), x) + Integral((g*tan(e + f*x))**p*sin(e + f*x)**2, x))
 

Maxima [F]

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

integrate((a+a*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="maxima")
 

Output:

integrate((a*sin(f*x + e) + a)^2*(g*tan(f*x + e))^p, x)
 

Giac [F]

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

integrate((a+a*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="giac")
 

Output:

integrate((a*sin(f*x + e) + a)^2*(g*tan(f*x + e))^p, x)
 

Mupad [F(-1)]

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

int((g*tan(e + f*x))^p*(a + a*sin(e + f*x))^2,x)
 

Output:

int((g*tan(e + f*x))^p*(a + a*sin(e + f*x))^2, x)
 

Reduce [F]

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

int((a+a*sin(f*x+e))^2*(g*tan(f*x+e))^p,x)
 

Output:

g**p*a**2*(int(tan(e + f*x)**p,x) + int(tan(e + f*x)**p*sin(e + f*x)**2,x) 
 + 2*int(tan(e + f*x)**p*sin(e + f*x),x))