\(\int \frac {\sec (c+d x)}{(a+b \tan ^2(c+d x))^2} \, dx\) [467]

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

Optimal result

Integrand size = 21, antiderivative size = 94 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\frac {(2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^{3/2} d}-\frac {b \sin (c+d x)}{2 a (a-b) d \left (a-(a-b) \sin ^2(c+d x)\right )} \] Output:

1/2*(2*a-b)*arctanh((a-b)^(1/2)*sin(d*x+c)/a^(1/2))/a^(3/2)/(a-b)^(3/2)/d- 
1/2*b*sin(d*x+c)/a/(a-b)/d/(a-(a-b)*sin(d*x+c)^2)
 

Mathematica [A] (verified)

Time = 0.15 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.21 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\frac {-\frac {1}{2} (2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right ) (a+b+(a-b) \cos (2 (c+d x)))+\sqrt {a} \sqrt {a-b} b \sin (c+d x)}{2 a^{3/2} (a-b)^{3/2} d \left (-a+(a-b) \sin ^2(c+d x)\right )} \] Input:

Integrate[Sec[c + d*x]/(a + b*Tan[c + d*x]^2)^2,x]
 

Output:

(-1/2*((2*a - b)*ArcTanh[(Sqrt[a - b]*Sin[c + d*x])/Sqrt[a]]*(a + b + (a - 
 b)*Cos[2*(c + d*x)])) + Sqrt[a]*Sqrt[a - b]*b*Sin[c + d*x])/(2*a^(3/2)*(a 
 - b)^(3/2)*d*(-a + (a - b)*Sin[c + d*x]^2))
 

Rubi [A] (verified)

Time = 0.25 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.98, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3042, 4159, 298, 221}

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 \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sec (c+d x)}{\left (a+b \tan (c+d x)^2\right )^2}dx\)

\(\Big \downarrow \) 4159

\(\displaystyle \frac {\int \frac {1-\sin ^2(c+d x)}{\left (a-(a-b) \sin ^2(c+d x)\right )^2}d\sin (c+d x)}{d}\)

\(\Big \downarrow \) 298

\(\displaystyle \frac {\frac {(2 a-b) \int \frac {1}{a-(a-b) \sin ^2(c+d x)}d\sin (c+d x)}{2 a (a-b)}-\frac {b \sin (c+d x)}{2 a (a-b) \left (a-(a-b) \sin ^2(c+d x)\right )}}{d}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {(2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^{3/2}}-\frac {b \sin (c+d x)}{2 a (a-b) \left (a-(a-b) \sin ^2(c+d x)\right )}}{d}\)

Input:

Int[Sec[c + d*x]/(a + b*Tan[c + d*x]^2)^2,x]
 

Output:

(((2*a - b)*ArcTanh[(Sqrt[a - b]*Sin[c + d*x])/Sqrt[a]])/(2*a^(3/2)*(a - b 
)^(3/2)) - (b*Sin[c + d*x])/(2*a*(a - b)*(a - (a - b)*Sin[c + d*x]^2)))/d
 

Defintions of rubi rules used

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 298
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-( 
b*c - a*d))*x*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - Simp[(a*d - b*c*( 
2*p + 3))/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, 
 c, d, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/2 + p, 0])
 

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

rule 4159
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_ 
))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff/f 
  Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 - ff^2 
*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f} 
, x] && IntegerQ[(m - 1)/2] && IntegerQ[n/2] && IntegerQ[p]
 
Maple [A] (verified)

Time = 1.93 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {\frac {b \sin \left (d x +c \right )}{2 a \left (a -b \right ) \left (a \sin \left (d x +c \right )^{2}-b \sin \left (d x +c \right )^{2}-a \right )}+\frac {\left (2 a -b \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \sin \left (d x +c \right )}{\sqrt {a \left (a -b \right )}}\right )}{2 a \left (a -b \right ) \sqrt {a \left (a -b \right )}}}{d}\) \(102\)
default \(\frac {\frac {b \sin \left (d x +c \right )}{2 a \left (a -b \right ) \left (a \sin \left (d x +c \right )^{2}-b \sin \left (d x +c \right )^{2}-a \right )}+\frac {\left (2 a -b \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \sin \left (d x +c \right )}{\sqrt {a \left (a -b \right )}}\right )}{2 a \left (a -b \right ) \sqrt {a \left (a -b \right )}}}{d}\) \(102\)
risch \(\frac {i b \left ({\mathrm e}^{3 i \left (d x +c \right )}-{\mathrm e}^{i \left (d x +c \right )}\right )}{a \left (-a +b \right ) d \left (-a \,{\mathrm e}^{4 i \left (d x +c \right )}+b \,{\mathrm e}^{4 i \left (d x +c \right )}-2 a \,{\mathrm e}^{2 i \left (d x +c \right )}-2 b \,{\mathrm e}^{2 i \left (d x +c \right )}-a +b \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right )}{2 \sqrt {a^{2}-a b}\, \left (a -b \right ) d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right ) b}{4 \sqrt {a^{2}-a b}\, \left (a -b \right ) d a}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right )}{2 \sqrt {a^{2}-a b}\, \left (a -b \right ) d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right ) b}{4 \sqrt {a^{2}-a b}\, \left (a -b \right ) d a}\) \(330\)

Input:

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

Output:

1/d*(1/2*b/a/(a-b)*sin(d*x+c)/(a*sin(d*x+c)^2-b*sin(d*x+c)^2-a)+1/2*(2*a-b 
)/a/(a-b)/(a*(a-b))^(1/2)*arctanh((a-b)*sin(d*x+c)/(a*(a-b))^(1/2)))
 

Fricas [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 337, normalized size of antiderivative = 3.59 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\left [\frac {{\left ({\left (2 \, a^{2} - 3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, a b - b^{2}\right )} \sqrt {a^{2} - a b} \log \left (-\frac {{\left (a - b\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - a b} \sin \left (d x + c\right ) - 2 \, a + b}{{\left (a - b\right )} \cos \left (d x + c\right )^{2} + b}\right ) - 2 \, {\left (a^{2} b - a b^{2}\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} d\right )}}, -\frac {{\left ({\left (2 \, a^{2} - 3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, a b - b^{2}\right )} \sqrt {-a^{2} + a b} \arctan \left (\frac {\sqrt {-a^{2} + a b} \sin \left (d x + c\right )}{a}\right ) + {\left (a^{2} b - a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} d\right )}}\right ] \] Input:

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

Output:

[1/4*(((2*a^2 - 3*a*b + b^2)*cos(d*x + c)^2 + 2*a*b - b^2)*sqrt(a^2 - a*b) 
*log(-((a - b)*cos(d*x + c)^2 - 2*sqrt(a^2 - a*b)*sin(d*x + c) - 2*a + b)/ 
((a - b)*cos(d*x + c)^2 + b)) - 2*(a^2*b - a*b^2)*sin(d*x + c))/((a^5 - 3* 
a^4*b + 3*a^3*b^2 - a^2*b^3)*d*cos(d*x + c)^2 + (a^4*b - 2*a^3*b^2 + a^2*b 
^3)*d), -1/2*(((2*a^2 - 3*a*b + b^2)*cos(d*x + c)^2 + 2*a*b - b^2)*sqrt(-a 
^2 + a*b)*arctan(sqrt(-a^2 + a*b)*sin(d*x + c)/a) + (a^2*b - a*b^2)*sin(d* 
x + c))/((a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3)*d*cos(d*x + c)^2 + (a^4*b - 
 2*a^3*b^2 + a^2*b^3)*d)]
 

Sympy [F]

\[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\int \frac {\sec {\left (c + d x \right )}}{\left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2}}\, dx \] Input:

integrate(sec(d*x+c)/(a+b*tan(d*x+c)**2)**2,x)
 

Output:

Integral(sec(c + d*x)/(a + b*tan(c + d*x)**2)**2, x)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\text {Exception raised: ValueError} \] Input:

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(b-a>0)', see `assume?` for more 
details)Is
 

Giac [A] (verification not implemented)

Time = 0.55 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.19 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=-\frac {\frac {{\left (2 \, a - b\right )} \arctan \left (\frac {a \sin \left (d x + c\right ) - b \sin \left (d x + c\right )}{\sqrt {-a^{2} + a b}}\right )}{{\left (a^{2} - a b\right )} \sqrt {-a^{2} + a b}} - \frac {b \sin \left (d x + c\right )}{{\left (a \sin \left (d x + c\right )^{2} - b \sin \left (d x + c\right )^{2} - a\right )} {\left (a^{2} - a b\right )}}}{2 \, d} \] Input:

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

Output:

-1/2*((2*a - b)*arctan((a*sin(d*x + c) - b*sin(d*x + c))/sqrt(-a^2 + a*b)) 
/((a^2 - a*b)*sqrt(-a^2 + a*b)) - b*sin(d*x + c)/((a*sin(d*x + c)^2 - b*si 
n(d*x + c)^2 - a)*(a^2 - a*b)))/d
 

Mupad [B] (verification not implemented)

Time = 8.88 (sec) , antiderivative size = 239, normalized size of antiderivative = 2.54 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=-\frac {\left (a^2\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}-\frac {b^2\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}+a^2\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}+\frac {b^2\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}+\frac {a\,b\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}-\frac {a\,b\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,3{}\mathrm {i}}{2}-\sqrt {a}\,b\,\sin \left (c+d\,x\right )\,\sqrt {a-b}\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a^{3/2}\,d\,{\left (a-b\right )}^{3/2}\,\left (\frac {a}{2}+\frac {b}{2}+\frac {a\,\cos \left (2\,c+2\,d\,x\right )}{2}-\frac {b\,\cos \left (2\,c+2\,d\,x\right )}{2}\right )} \] Input:

int(1/(cos(c + d*x)*(a + b*tan(c + d*x)^2)^2),x)
 

Output:

-((a^2*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*1i - (b^2*atanh((sin(c 
+ d*x)*(a - b)^(1/2))/a^(1/2))*1i)/2 + a^2*cos(2*c + 2*d*x)*atanh((sin(c + 
 d*x)*(a - b)^(1/2))/a^(1/2))*1i + (b^2*cos(2*c + 2*d*x)*atanh((sin(c + d* 
x)*(a - b)^(1/2))/a^(1/2))*1i)/2 + (a*b*atanh((sin(c + d*x)*(a - b)^(1/2)) 
/a^(1/2))*1i)/2 - (a*b*cos(2*c + 2*d*x)*atanh((sin(c + d*x)*(a - b)^(1/2)) 
/a^(1/2))*3i)/2 - a^(1/2)*b*sin(c + d*x)*(a - b)^(1/2)*1i)*1i)/(2*a^(3/2)* 
d*(a - b)^(3/2)*(a/2 + b/2 + (a*cos(2*c + 2*d*x))/2 - (b*cos(2*c + 2*d*x)) 
/2))
 

Reduce [B] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 628, normalized size of antiderivative = 6.68 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx =\text {Too large to display} \] Input:

int(sec(d*x+c)/(a+b*tan(d*x+c)^2)^2,x)
 

Output:

( - 2*sqrt(a)*sqrt(a - b)*log( - 2*sqrt(a - b)*tan((c + d*x)/2) + sqrt(a)* 
tan((c + d*x)/2)**2 + sqrt(a))*sin(c + d*x)**2*a**2 + 3*sqrt(a)*sqrt(a - b 
)*log( - 2*sqrt(a - b)*tan((c + d*x)/2) + sqrt(a)*tan((c + d*x)/2)**2 + sq 
rt(a))*sin(c + d*x)**2*a*b - sqrt(a)*sqrt(a - b)*log( - 2*sqrt(a - b)*tan( 
(c + d*x)/2) + sqrt(a)*tan((c + d*x)/2)**2 + sqrt(a))*sin(c + d*x)**2*b**2 
 + 2*sqrt(a)*sqrt(a - b)*log( - 2*sqrt(a - b)*tan((c + d*x)/2) + sqrt(a)*t 
an((c + d*x)/2)**2 + sqrt(a))*a**2 - sqrt(a)*sqrt(a - b)*log( - 2*sqrt(a - 
 b)*tan((c + d*x)/2) + sqrt(a)*tan((c + d*x)/2)**2 + sqrt(a))*a*b + 2*sqrt 
(a)*sqrt(a - b)*log(2*sqrt(a - b)*tan((c + d*x)/2) + sqrt(a)*tan((c + d*x) 
/2)**2 + sqrt(a))*sin(c + d*x)**2*a**2 - 3*sqrt(a)*sqrt(a - b)*log(2*sqrt( 
a - b)*tan((c + d*x)/2) + sqrt(a)*tan((c + d*x)/2)**2 + sqrt(a))*sin(c + d 
*x)**2*a*b + sqrt(a)*sqrt(a - b)*log(2*sqrt(a - b)*tan((c + d*x)/2) + sqrt 
(a)*tan((c + d*x)/2)**2 + sqrt(a))*sin(c + d*x)**2*b**2 - 2*sqrt(a)*sqrt(a 
 - b)*log(2*sqrt(a - b)*tan((c + d*x)/2) + sqrt(a)*tan((c + d*x)/2)**2 + s 
qrt(a))*a**2 + sqrt(a)*sqrt(a - b)*log(2*sqrt(a - b)*tan((c + d*x)/2) + sq 
rt(a)*tan((c + d*x)/2)**2 + sqrt(a))*a*b + 2*sin(c + d*x)*a**2*b - 2*sin(c 
 + d*x)*a*b**2)/(4*a**2*d*(sin(c + d*x)**2*a**3 - 3*sin(c + d*x)**2*a**2*b 
 + 3*sin(c + d*x)**2*a*b**2 - sin(c + d*x)**2*b**3 - a**3 + 2*a**2*b - a*b 
**2))