\(\int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx\) [323]

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

Optimal result

Integrand size = 23, antiderivative size = 74 \[ \int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx=-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{\sqrt {a} f}+\frac {\text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b} f} \] Output:

-arctanh((a+b*tan(f*x+e)^2)^(1/2)/a^(1/2))/a^(1/2)/f+arctanh((a+b*tan(f*x+ 
e)^2)^(1/2)/(a-b)^(1/2))/(a-b)^(1/2)/f
 

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.97 \[ \int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx=\frac {-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{\sqrt {a}}+\frac {\text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}}}{f} \] Input:

Integrate[Cot[e + f*x]/Sqrt[a + b*Tan[e + f*x]^2],x]
 

Output:

(-(ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[a]]/Sqrt[a]) + ArcTanh[Sqrt[a + 
 b*Tan[e + f*x]^2]/Sqrt[a - b]]/Sqrt[a - b])/f
 

Rubi [A] (verified)

Time = 0.48 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.03, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4153, 354, 97, 73, 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 {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\tan (e+f x) \sqrt {a+b \tan (e+f x)^2}}dx\)

\(\Big \downarrow \) 4153

\(\displaystyle \frac {\int \frac {\cot (e+f x)}{\left (\tan ^2(e+f x)+1\right ) \sqrt {b \tan ^2(e+f x)+a}}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 354

\(\displaystyle \frac {\int \frac {\cot (e+f x)}{\left (\tan ^2(e+f x)+1\right ) \sqrt {b \tan ^2(e+f x)+a}}d\tan ^2(e+f x)}{2 f}\)

\(\Big \downarrow \) 97

\(\displaystyle \frac {\int \frac {\cot (e+f x)}{\sqrt {b \tan ^2(e+f x)+a}}d\tan ^2(e+f x)-\int \frac {1}{\left (\tan ^2(e+f x)+1\right ) \sqrt {b \tan ^2(e+f x)+a}}d\tan ^2(e+f x)}{2 f}\)

\(\Big \downarrow \) 73

\(\displaystyle \frac {\frac {2 \int \frac {1}{\frac {\tan ^4(e+f x)}{b}-\frac {a}{b}}d\sqrt {b \tan ^2(e+f x)+a}}{b}-\frac {2 \int \frac {1}{\frac {\tan ^4(e+f x)}{b}-\frac {a}{b}+1}d\sqrt {b \tan ^2(e+f x)+a}}{b}}{2 f}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}}-\frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{\sqrt {a}}}{2 f}\)

Input:

Int[Cot[e + f*x]/Sqrt[a + b*Tan[e + f*x]^2],x]
 

Output:

((-2*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[a]])/Sqrt[a] + (2*ArcTanh[Sqr 
t[a + b*Tan[e + f*x]^2]/Sqrt[a - b]])/Sqrt[a - b])/(2*f)
 

Defintions of rubi rules used

rule 73
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[ 
{p = Denominator[m]}, Simp[p/b   Subst[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + 
 d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] && Lt 
Q[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntL 
inearQ[a, b, c, d, m, n, x]
 

rule 97
Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), 
x_] :> Simp[b/(b*c - a*d)   Int[(e + f*x)^p/(a + b*x), x], x] - Simp[d/(b*c 
 - a*d)   Int[(e + f*x)^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, p}, 
 x] &&  !IntegerQ[p]
 

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 354
Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q_.), x_S 
ymbol] :> Simp[1/2   Subst[Int[x^((m - 1)/2)*(a + b*x)^p*(c + d*x)^q, x], x 
, x^2], x] /; FreeQ[{a, b, c, d, p, q}, x] && NeQ[b*c - a*d, 0] && IntegerQ 
[(m - 1)/2]
 

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

rule 4153
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], 
 x]}, Simp[c*(ff/f)   Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f 
f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, 
n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio 
nalQ[n]))
 
Maple [B] (warning: unable to verify)

Leaf count of result is larger than twice the leaf count of optimal. \(443\) vs. \(2(62)=124\).

Time = 6.28 (sec) , antiderivative size = 444, normalized size of antiderivative = 6.00

method result size
default \(-\frac {\sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \left (2 \ln \left (4 \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \cos \left (f x +e \right )+4 \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}+4 a \cos \left (f x +e \right )-4 \cos \left (f x +e \right ) b \right ) \sqrt {a}-\ln \left (\frac {-2 a \left (1-\cos \left (f x +e \right )\right )^{2}+4 \left (1-\cos \left (f x +e \right )\right )^{2} b +4 \sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \sqrt {a}\, \sin \left (f x +e \right )^{2}+2 a \sin \left (f x +e \right )^{2}}{\left (1-\cos \left (f x +e \right )\right )^{2}}\right ) \sqrt {a -b}+\ln \left (\frac {2 \sqrt {a}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \cos \left (f x +e \right )+2 \sqrt {\frac {a \cos \left (f x +e \right )^{2}+b \sin \left (f x +e \right )^{2}}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \sqrt {a}-2 a \cos \left (f x +e \right )+2 \cos \left (f x +e \right ) b +2 b}{\sqrt {a}\, \left (\cos \left (f x +e \right )+1\right )}\right ) \sqrt {a -b}\right )}{f \sqrt {a}\, \sqrt {a -b}\, \sqrt {a +b \tan \left (f x +e \right )^{2}}\, \left (\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1\right )}\) \(444\)

Input:

int(cot(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)
 

Output:

-1/f/a^(1/2)/(a-b)^(1/2)*((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos(f*x+e)+1)^2 
)^(1/2)*(2*ln(4*(a-b)^(1/2)*((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos(f*x+e)+1 
)^2)^(1/2)*cos(f*x+e)+4*(a-b)^(1/2)*((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos( 
f*x+e)+1)^2)^(1/2)+4*a*cos(f*x+e)-4*cos(f*x+e)*b)*a^(1/2)-ln(2/(1-cos(f*x+ 
e))^2*(-a*(1-cos(f*x+e))^2+2*(1-cos(f*x+e))^2*b+2*((a*cos(f*x+e)^2+b*sin(f 
*x+e)^2)/(cos(f*x+e)+1)^2)^(1/2)*a^(1/2)*sin(f*x+e)^2+a*sin(f*x+e)^2))*(a- 
b)^(1/2)+ln(2/a^(1/2)*(a^(1/2)*((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos(f*x+e 
)+1)^2)^(1/2)*cos(f*x+e)+((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos(f*x+e)+1)^2 
)^(1/2)*a^(1/2)-a*cos(f*x+e)+cos(f*x+e)*b+b)/(cos(f*x+e)+1))*(a-b)^(1/2))/ 
(a+b*tan(f*x+e)^2)^(1/2)/((1-cos(f*x+e))^2*csc(f*x+e)^2-1)
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 426, normalized size of antiderivative = 5.76 \[ \int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx=\left [\frac {\sqrt {a - b} a \log \left (\frac {b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a - b} + 2 \, a - b}{\tan \left (f x + e\right )^{2} + 1}\right ) + {\left (a - b\right )} \sqrt {a} \log \left (\frac {b \tan \left (f x + e\right )^{2} - 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a} + 2 \, a}{\tan \left (f x + e\right )^{2}}\right )}{2 \, {\left (a^{2} - a b\right )} f}, -\frac {2 \, a \sqrt {-a + b} \arctan \left (\frac {\sqrt {-a + b}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right ) - {\left (a - b\right )} \sqrt {a} \log \left (\frac {b \tan \left (f x + e\right )^{2} - 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a} + 2 \, a}{\tan \left (f x + e\right )^{2}}\right )}{2 \, {\left (a^{2} - a b\right )} f}, \frac {2 \, \sqrt {-a} {\left (a - b\right )} \arctan \left (\frac {\sqrt {-a}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right ) + \sqrt {a - b} a \log \left (\frac {b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a - b} + 2 \, a - b}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, {\left (a^{2} - a b\right )} f}, \frac {\sqrt {-a} {\left (a - b\right )} \arctan \left (\frac {\sqrt {-a}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right ) - a \sqrt {-a + b} \arctan \left (\frac {\sqrt {-a + b}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right )}{{\left (a^{2} - a b\right )} f}\right ] \] Input:

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="fricas")
 

Output:

[1/2*(sqrt(a - b)*a*log((b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*s 
qrt(a - b) + 2*a - b)/(tan(f*x + e)^2 + 1)) + (a - b)*sqrt(a)*log((b*tan(f 
*x + e)^2 - 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a) + 2*a)/tan(f*x + e)^2))/( 
(a^2 - a*b)*f), -1/2*(2*a*sqrt(-a + b)*arctan(sqrt(-a + b)/sqrt(b*tan(f*x 
+ e)^2 + a)) - (a - b)*sqrt(a)*log((b*tan(f*x + e)^2 - 2*sqrt(b*tan(f*x + 
e)^2 + a)*sqrt(a) + 2*a)/tan(f*x + e)^2))/((a^2 - a*b)*f), 1/2*(2*sqrt(-a) 
*(a - b)*arctan(sqrt(-a)/sqrt(b*tan(f*x + e)^2 + a)) + sqrt(a - b)*a*log(( 
b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a - b) + 2*a - b)/(ta 
n(f*x + e)^2 + 1)))/((a^2 - a*b)*f), (sqrt(-a)*(a - b)*arctan(sqrt(-a)/sqr 
t(b*tan(f*x + e)^2 + a)) - a*sqrt(-a + b)*arctan(sqrt(-a + b)/sqrt(b*tan(f 
*x + e)^2 + a)))/((a^2 - a*b)*f)]
 

Sympy [F]

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

integrate(cot(f*x+e)/(a+b*tan(f*x+e)**2)**(1/2),x)
 

Output:

Integral(cot(e + f*x)/sqrt(a + b*tan(e + f*x)**2), x)
 

Maxima [F]

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

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="maxima")
 

Output:

integrate(cot(f*x + e)/sqrt(b*tan(f*x + e)^2 + a), x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx=\text {Exception raised: TypeError} \] Input:

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Error: Bad Argument Type
 

Mupad [B] (verification not implemented)

Time = 8.58 (sec) , antiderivative size = 232, normalized size of antiderivative = 3.14 \[ \int \frac {\cot (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}} \, dx=-\frac {\mathrm {atanh}\left (\frac {\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}}{\sqrt {a}}\right )}{\sqrt {a}\,f}-\frac {\mathrm {atanh}\left (\frac {4\,a\,b^2\,\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}}{\left (\frac {2\,b^4\,f^3}{a\,f^3-b\,f^3}-\frac {2\,a\,b^3\,f^3}{a\,f^3-b\,f^3}\right )\,\sqrt {a-b}}-\frac {2\,b^3\,\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}}{\left (\frac {2\,b^4\,f^3}{a\,f^3-b\,f^3}-\frac {2\,a\,b^3\,f^3}{a\,f^3-b\,f^3}\right )\,\sqrt {a-b}}+\frac {2\,\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}\,\left (a\,f^3-b\,f^3\right )}{b\,f^3\,\sqrt {a-b}}\right )}{f\,\sqrt {a-b}} \] Input:

int(cot(e + f*x)/(a + b*tan(e + f*x)^2)^(1/2),x)
 

Output:

- atanh((a + b*tan(e + f*x)^2)^(1/2)/a^(1/2))/(a^(1/2)*f) - atanh((4*a*b^2 
*(a + b*tan(e + f*x)^2)^(1/2))/(((2*b^4*f^3)/(a*f^3 - b*f^3) - (2*a*b^3*f^ 
3)/(a*f^3 - b*f^3))*(a - b)^(1/2)) - (2*b^3*(a + b*tan(e + f*x)^2)^(1/2))/ 
(((2*b^4*f^3)/(a*f^3 - b*f^3) - (2*a*b^3*f^3)/(a*f^3 - b*f^3))*(a - b)^(1/ 
2)) + (2*(a + b*tan(e + f*x)^2)^(1/2)*(a*f^3 - b*f^3))/(b*f^3*(a - b)^(1/2 
)))/(f*(a - b)^(1/2))
 

Reduce [F]

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

int(cot(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2),x)
 

Output:

int((sqrt(tan(e + f*x)**2*b + a)*cot(e + f*x))/(tan(e + f*x)**2*b + a),x)