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

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 = 186 \[ \int (a+b \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 b \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 {b^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*b*(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)+b^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 = 14.97 (sec) , antiderivative size = 2464, normalized size of antiderivative = 13.25 \[ \int (a+b \sin (e+f x))^2 (g \tan (e+f x))^p \, dx=\text {Result too large to show} \] Input:

Integrate[(a + b*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*Tan[(e + f*x)/2]*(a^2*(2 + p)*Appel 
lF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 
 4*b*(b*(2 + p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, - 
Tan[(e + f*x)/2]^2] - b*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 + p)/2, Tan[( 
e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + a*(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*(-1/4*(b^2*Cos[2*(e + f*x)]^3*Tan[e + f*x]^p) + (I/4)*b^2*Sin[ 
2*(e + f*x)]*Tan[e + f*x]^p + I*a^2*Sin[e + f*x]^2*Sin[2*(e + f*x)]*Tan[e 
+ f*x]^p + (b^2*Sin[2*(e + f*x)]^2*Tan[e + f*x]^p)/2 - (I/4)*b^2*Sin[2*(e 
+ f*x)]^3*Tan[e + f*x]^p + Cos[e + f*x]^2*(a^2*Cos[2*(e + f*x)]*Tan[e + f* 
x]^p - I*a^2*Sin[2*(e + f*x)]*Tan[e + f*x]^p) + Cos[2*(e + f*x)]^2*((b^2*T 
an[e + f*x]^p)/2 + a*b*Sin[e + f*x]*Tan[e + f*x]^p - (I/4)*b^2*Sin[2*(e + 
f*x)]*Tan[e + f*x]^p) + Sin[e + f*x]*(I*a*b*Sin[2*(e + f*x)]*Tan[e + f*x]^ 
p + a*b*Sin[2*(e + f*x)]^2*Tan[e + f*x]^p) + Cos[2*(e + f*x)]*(-1/4*(b^2*T 
an[e + f*x]^p) - a*b*Sin[e + f*x]*Tan[e + f*x]^p - a^2*Sin[e + f*x]^2*Tan[ 
e + f*x]^p - (b^2*Sin[2*(e + f*x)]^2*Tan[e + f*x]^p)/4) + Cos[e + f*x]*((- 
I)*a*b*Cos[2*(e + f*x)]^2*Tan[e + f*x]^p + a*b*Sin[2*(e + f*x)]*Tan[e + f* 
x]^p + 2*a^2*Sin[e + f*x]*Sin[2*(e + f*x)]*Tan[e + f*x]^p - I*a*b*Sin[2*(e 
 + f*x)]^2*Tan[e + f*x]^p + Cos[2*(e + f*x)]*(I*a*b*Tan[e + f*x]^p + (2*I) 
*a^2*Sin[e + f*x]*Tan[e + f*x]^p))))/(f*(1 + p)*(2 + p)*((2*p*(Cos[e + ...
 

Rubi [A] (verified)

Time = 0.46 (sec) , antiderivative size = 186, 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, 3201, 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+b \sin (e+f x))^2 (g \tan (e+f x))^p \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3201

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

\(\Big \downarrow \) 2009

\(\displaystyle \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 b \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)}+\frac {b^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)}\)

Input:

Int[(a + b*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*b*(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)) + (b^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 3201
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] && NeQ[a^2 - b^2, 0] 
&& IGtQ[m, 0]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

Timed out. \[ \int (a+b \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+b\,\sin \left (e+f\,x\right )\right )}^2 \,d x \] Input:

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

Output:

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

Reduce [F]

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

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

Output:

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