\(\int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx\) [705]

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 = 23, antiderivative size = 155 \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=-\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {\left (b^2-a^2 (1-m)\right ) \cos (e+f x) (d \cos (e+f x))^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{f (1-m) (1+m) \sqrt {\sin ^2(e+f x)}}+\frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)} \] Output:

-a*b*(2-m)*(d*cos(f*x+e))^m/f/(1-m)/m+(b^2-a^2*(1-m))*cos(f*x+e)*(d*cos(f* 
x+e))^m*hypergeom([1/2, 1/2+1/2*m],[3/2+1/2*m],cos(f*x+e)^2)*sin(f*x+e)/f/ 
(1-m)/(1+m)/(sin(f*x+e)^2)^(1/2)+b*(d*cos(f*x+e))^m*(a+b*tan(f*x+e))/f/(1- 
m)
 

Mathematica [A] (verified)

Time = 3.48 (sec) , antiderivative size = 140, normalized size of antiderivative = 0.90 \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\frac {(d \cos (e+f x))^m \left (2 a b \left (-1+\sec ^2(e+f x)^{m/2}\right )+b^2 m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m}{2},\frac {3}{2},-\tan ^2(e+f x)\right ) \sec ^2(e+f x)^{m/2} \tan (e+f x)+\left (a^2-b^2\right ) m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+m}{2},\frac {3}{2},-\tan ^2(e+f x)\right ) \sec ^2(e+f x)^{m/2} \tan (e+f x)\right )}{f m} \] Input:

Integrate[(d*Cos[e + f*x])^m*(a + b*Tan[e + f*x])^2,x]
 

Output:

((d*Cos[e + f*x])^m*(2*a*b*(-1 + (Sec[e + f*x]^2)^(m/2)) + b^2*m*Hypergeom 
etric2F1[1/2, m/2, 3/2, -Tan[e + f*x]^2]*(Sec[e + f*x]^2)^(m/2)*Tan[e + f* 
x] + (a^2 - b^2)*m*Hypergeometric2F1[1/2, (2 + m)/2, 3/2, -Tan[e + f*x]^2] 
*(Sec[e + f*x]^2)^(m/2)*Tan[e + f*x]))/(f*m)
 

Rubi [A] (verified)

Time = 0.85 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.13, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.478, Rules used = {3042, 3998, 3042, 3993, 25, 3042, 3967, 3042, 4259, 3042, 3122}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x))^2 (d \cos (e+f x))^mdx\)

\(\Big \downarrow \) 3998

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \int (d \sec (e+f x))^{-m} (a+b \tan (e+f x))^2dx\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \int (d \sec (e+f x))^{-m} (a+b \tan (e+f x))^2dx\)

\(\Big \downarrow \) 3993

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {\int -(d \sec (e+f x))^{-m} \left (-\left ((1-m) a^2\right )-b (2-m) \tan (e+f x) a+b^2\right )dx}{1-m}+\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\int (d \sec (e+f x))^{-m} \left (-\left ((1-m) a^2\right )-b (2-m) \tan (e+f x) a+b^2\right )dx}{1-m}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\int (d \sec (e+f x))^{-m} \left (-\left ((1-m) a^2\right )-b (2-m) \tan (e+f x) a+b^2\right )dx}{1-m}\right )\)

\(\Big \downarrow \) 3967

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\left (b^2-a^2 (1-m)\right ) \int (d \sec (e+f x))^{-m}dx+\frac {a b (2-m) (d \sec (e+f x))^{-m}}{f m}}{1-m}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\left (b^2-a^2 (1-m)\right ) \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{-m}dx+\frac {a b (2-m) (d \sec (e+f x))^{-m}}{f m}}{1-m}\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\left (b^2-a^2 (1-m)\right ) \left (\frac {\cos (e+f x)}{d}\right )^{-m} (d \sec (e+f x))^{-m} \int \left (\frac {\cos (e+f x)}{d}\right )^mdx+\frac {a b (2-m) (d \sec (e+f x))^{-m}}{f m}}{1-m}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\left (b^2-a^2 (1-m)\right ) \left (\frac {\cos (e+f x)}{d}\right )^{-m} (d \sec (e+f x))^{-m} \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^mdx+\frac {a b (2-m) (d \sec (e+f x))^{-m}}{f m}}{1-m}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle (d \cos (e+f x))^m (d \sec (e+f x))^m \left (\frac {b (a+b \tan (e+f x)) (d \sec (e+f x))^{-m}}{f (1-m)}-\frac {\frac {a b (2-m) (d \sec (e+f x))^{-m}}{f m}-\frac {d \left (b^2-a^2 (1-m)\right ) \sin (e+f x) (d \sec (e+f x))^{-m-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m+1}{2},\frac {m+3}{2},\cos ^2(e+f x)\right )}{f (m+1) \sqrt {\sin ^2(e+f x)}}}{1-m}\right )\)

Input:

Int[(d*Cos[e + f*x])^m*(a + b*Tan[e + f*x])^2,x]
 

Output:

(d*Cos[e + f*x])^m*(d*Sec[e + f*x])^m*(-(((a*b*(2 - m))/(f*m*(d*Sec[e + f* 
x])^m) - (d*(b^2 - a^2*(1 - m))*Hypergeometric2F1[1/2, (1 + m)/2, (3 + m)/ 
2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^(-1 - m)*Sin[e + f*x])/(f*(1 + m)*Sqrt 
[Sin[e + f*x]^2]))/(1 - m)) + (b*(a + b*Tan[e + f*x]))/(f*(1 - m)*(d*Sec[e 
 + f*x])^m))
 

Defintions of rubi rules used

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

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

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 3967
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*( 
x_)]), x_Symbol] :> Simp[b*((d*Sec[e + f*x])^m/(f*m)), x] + Simp[a   Int[(d 
*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2*m] 
|| NeQ[a^2 + b^2, 0])
 

rule 3993
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*( 
x_)])^2, x_Symbol] :> Simp[b*(d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])/(f*(m 
 + 1))), x] + Simp[1/(m + 1)   Int[(d*Sec[e + f*x])^m*(a^2*(m + 1) - b^2 + 
a*b*(m + 2)*Tan[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && NeQ[a^ 
2 + b^2, 0] &&  !IntegerQ[m]
 

rule 3998
Int[(cos[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x 
_)])^(n_.), x_Symbol] :> Simp[(d*Cos[e + f*x])^m*(d*Sec[e + f*x])^m   Int[( 
a + b*Tan[e + f*x])^n/(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m 
, n}, x] &&  !IntegerQ[m]
 

rule 4259
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^(n - 1)*((Sin[c + d*x]/b)^(n - 1)   Int[1/(Sin[c + d*x]/b)^n, x]), x] /; 
FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]
 
Maple [F]

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

Input:

int((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x)
 

Output:

int((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x)
 

Fricas [F]

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

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="fricas")
 

Output:

integral((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2)*(d*cos(f*x + e))^ 
m, x)
 

Sympy [F]

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

integrate((d*cos(f*x+e))**m*(a+b*tan(f*x+e))**2,x)
 

Output:

Integral((d*cos(e + f*x))**m*(a + b*tan(e + f*x))**2, x)
 

Maxima [F]

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

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="maxima")
 

Output:

integrate((b*tan(f*x + e) + a)^2*(d*cos(f*x + e))^m, x)
 

Giac [F]

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

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="giac")
 

Output:

integrate((b*tan(f*x + e) + a)^2*(d*cos(f*x + e))^m, x)
 

Mupad [F(-1)]

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

int((d*cos(e + f*x))^m*(a + b*tan(e + f*x))^2,x)
 

Output:

int((d*cos(e + f*x))^m*(a + b*tan(e + f*x))^2, x)
 

Reduce [F]

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

int((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x)
 

Output:

d**m*(int(cos(e + f*x)**m,x)*a**2 + int(cos(e + f*x)**m*tan(e + f*x)**2,x) 
*b**2 + 2*int(cos(e + f*x)**m*tan(e + f*x),x)*a*b)