\(\int \sec ^2(x) (a+b \tan (x))^n \, dx\) [693]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F(-2)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 19 \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\frac {(a+b \tan (x))^{1+n}}{b (1+n)} \]

[Out]

(a+b*tan(x))^(1+n)/b/(1+n)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3587, 32} \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\frac {(a+b \tan (x))^{n+1}}{b (n+1)} \]

[In]

Int[Sec[x]^2*(a + b*Tan[x])^n,x]

[Out]

(a + b*Tan[x])^(1 + n)/(b*(1 + n))

Rule 32

Int[((a_.) + (b_.)*(x_))^(m_), x_Symbol] :> Simp[(a + b*x)^(m + 1)/(b*(m + 1)), x] /; FreeQ[{a, b, m}, x] && N
eQ[m, -1]

Rule 3587

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(b*f), Subst
[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b
^2, 0] && IntegerQ[m/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int (a+x)^n \, dx,x,b \tan (x)\right )}{b} \\ & = \frac {(a+b \tan (x))^{1+n}}{b (1+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.14 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00 \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\frac {(a+b \tan (x))^{1+n}}{b (1+n)} \]

[In]

Integrate[Sec[x]^2*(a + b*Tan[x])^n,x]

[Out]

(a + b*Tan[x])^(1 + n)/(b*(1 + n))

Maple [A] (verified)

Time = 12.98 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.05

method result size
derivativedivides \(\frac {\left (a +b \tan \left (x \right )\right )^{n +1}}{b \left (n +1\right )}\) \(20\)
default \(\frac {\left (a +b \tan \left (x \right )\right )^{n +1}}{b \left (n +1\right )}\) \(20\)

[In]

int(sec(x)^2*(a+b*tan(x))^n,x,method=_RETURNVERBOSE)

[Out]

(a+b*tan(x))^(n+1)/b/(n+1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.95 \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\frac {{\left (a \cos \left (x\right ) + b \sin \left (x\right )\right )} \left (\frac {a \cos \left (x\right ) + b \sin \left (x\right )}{\cos \left (x\right )}\right )^{n}}{{\left (b n + b\right )} \cos \left (x\right )} \]

[In]

integrate(sec(x)^2*(a+b*tan(x))^n,x, algorithm="fricas")

[Out]

(a*cos(x) + b*sin(x))*((a*cos(x) + b*sin(x))/cos(x))^n/((b*n + b)*cos(x))

Sympy [F]

\[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\int \left (a + b \tan {\left (x \right )}\right )^{n} \sec ^{2}{\left (x \right )}\, dx \]

[In]

integrate(sec(x)**2*(a+b*tan(x))**n,x)

[Out]

Integral((a + b*tan(x))**n*sec(x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00 \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\frac {{\left (b \tan \left (x\right ) + a\right )}^{n + 1}}{b {\left (n + 1\right )}} \]

[In]

integrate(sec(x)^2*(a+b*tan(x))^n,x, algorithm="maxima")

[Out]

(b*tan(x) + a)^(n + 1)/(b*(n + 1))

Giac [F(-2)]

Exception generated. \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\text {Exception raised: TypeError} \]

[In]

integrate(sec(x)^2*(a+b*tan(x))^n,x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Unable to divide, perhaps due to rounding error%%%{1,[0,1,0]%%%} / %%%{1,[0,0,1]%%%} Error: Bad Argument Va
lue

Mupad [B] (verification not implemented)

Time = 27.66 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.95 \[ \int \sec ^2(x) (a+b \tan (x))^n \, dx=\left \{\begin {array}{cl} \frac {\ln \left (a+b\,\mathrm {tan}\left (x\right )\right )}{b} & \text {\ if\ \ }n=-1\\ \frac {{\left (a+b\,\mathrm {tan}\left (x\right )\right )}^{n+1}}{b\,\left (n+1\right )} & \text {\ if\ \ }n\neq -1 \end {array}\right . \]

[In]

int((a + b*tan(x))^n/cos(x)^2,x)

[Out]

piecewise(n == -1, log(a + b*tan(x))/b, n ~= -1, (a + b*tan(x))^(n + 1)/(b*(n + 1)))