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

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

Optimal result

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.47 (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, 94, 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 \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4153

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

\(\Big \downarrow \) 354

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

\(\Big \downarrow \) 94

\(\displaystyle \frac {a \int \frac {\cot (e+f x)}{\sqrt {b \tan ^2(e+f x)+a}}d\tan ^2(e+f x)-(a-b) \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 a \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 (a-b) \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 {2 \sqrt {a-b} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )-2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{2 f}\)

Input:

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

Output:

(-2*Sqrt[a]*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[a]] + 2*Sqrt[a - b]*Ar 
cTanh[Sqrt[a + b*Tan[e + f*x]^2]/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 94
Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), 
x_] :> Simp[(b*e - a*f)/(b*c - a*d)   Int[(e + f*x)^(p - 1)/(a + b*x), x], 
x] - Simp[(d*e - c*f)/(b*c - a*d)   Int[(e + f*x)^(p - 1)/(c + d*x), x], x] 
 /; FreeQ[{a, b, c, d, e, f}, x] && LtQ[0, p, 1]
 

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. \(568\) vs. \(2(62)=124\).

Time = 6.56 (sec) , antiderivative size = 569, normalized size of antiderivative = 7.69

method result size
default \(\frac {\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 ) a^{\frac {3}{2}}+\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}\, a -a \ln \left (\frac {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}-2 a \cos \left (f x +e \right )^{2}+4 b \cos \left (f x +e \right )^{2}+4 a \cos \left (f x +e \right )-8 \cos \left (f x +e \right ) b -2 a +4 b}{\left (\cos \left (f x +e \right )-1\right )^{2}}\right ) \sqrt {a -b}-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}\, b \right ) \sqrt {a +b \tan \left (f x +e \right )^{2}}\, \cos \left (f x +e \right )}{2 f \sqrt {a}\, \sqrt {a -b}\, \left (\cos \left (f x +e \right )+1\right ) \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}}}}\) \(569\)

Input:

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

Output:

1/2/f/a^(1/2)/(a-b)^(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*s 
in(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^(3/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-a*ln(2 
*(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*cos(f*x+e)^2+2*b*cos(f*x+e)^2+2*a*cos(f*x+e)-4*co 
s(f*x+e)*b-a+2*b)/(cos(f*x+e)-1)^2)*(a-b)^(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)*b)*(a+b*tan(f*x+e)^2)^(1/2)*cos(f*x+e)/(cos(f*x+e)+ 
1)/((a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(cos(f*x+e)+1)^2)^(1/2)
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 362, normalized size of antiderivative = 4.89 \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\left [\frac {\sqrt {a - b} \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 ) + \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 \, f}, -\frac {2 \, \sqrt {-a + b} \arctan \left (\frac {\sqrt {-a + b}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\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 \, f}, \frac {2 \, \sqrt {-a} \arctan \left (\frac {\sqrt {-a}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right ) + \sqrt {a - b} \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 \, f}, \frac {\sqrt {-a} \arctan \left (\frac {\sqrt {-a}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\right ) - \sqrt {-a + b} \arctan \left (\frac {\sqrt {-a + b}}{\sqrt {b \tan \left (f x + e\right )^{2} + a}}\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)*log((b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqr 
t(a - b) + 2*a - b)/(tan(f*x + e)^2 + 1)) + 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))/f, -1/2*(2* 
sqrt(-a + b)*arctan(sqrt(-a + b)/sqrt(b*tan(f*x + e)^2 + a)) - 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))/f, 1/2*(2*sqrt(-a)*arctan(sqrt(-a)/sqrt(b*tan(f*x + e)^2 + a)) + s 
qrt(a - b)*log((b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a - b 
) + 2*a - b)/(tan(f*x + e)^2 + 1)))/f, (sqrt(-a)*arctan(sqrt(-a)/sqrt(b*ta 
n(f*x + e)^2 + a)) - sqrt(-a + b)*arctan(sqrt(-a + b)/sqrt(b*tan(f*x + e)^ 
2 + a)))/f]
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^(1/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 [F(-2)]

Exception generated. \[ \int \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:Degree mismatch inside factorisatio 
n over extensionDegree mismatch inside factorisation over extensionDegree 
mismatch
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [F]

\[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\int \sqrt {\tan \left (f x +e \right )^{2} b +a}\, \cot \left (f x +e \right )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),x)