\(\int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx\) [104]

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

Optimal result

Integrand size = 27, antiderivative size = 102 \[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=-\frac {(i a-b) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a-i b}}\right )}{\sqrt {a-i b} d}+\frac {(i a+b) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a+i b}}\right )}{\sqrt {a+i b} d} \] Output:

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

Mathematica [A] (verified)

Time = 0.27 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.34 \[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=\frac {\frac {\left (b^2-a \sqrt {-b^2}\right ) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {-b^2}}}\right )}{\sqrt {a-\sqrt {-b^2}}}+\frac {\left (b^2+a \sqrt {-b^2}\right ) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a+\sqrt {-b^2}}}\right )}{\sqrt {a+\sqrt {-b^2}}}}{b d} \] Input:

Integrate[(-a + b*Cot[c + d*x])/Sqrt[a + b*Cot[c + d*x]],x]
 

Output:

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

Rubi [A] (warning: unable to verify)

Time = 0.47 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.81, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.259, Rules used = {3042, 4022, 3042, 4020, 25, 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 {b \cot (c+d x)-a}{\sqrt {a+b \cot (c+d x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {-a-b \tan \left (c+d x+\frac {\pi }{2}\right )}{\sqrt {a-b \tan \left (c+d x+\frac {\pi }{2}\right )}}dx\)

\(\Big \downarrow \) 4022

\(\displaystyle -\frac {1}{2} (a-i b) \int \frac {1-i \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}}dx-\frac {1}{2} (a+i b) \int \frac {i \cot (c+d x)+1}{\sqrt {a+b \cot (c+d x)}}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {1}{2} (a+i b) \int \frac {1-i \tan \left (c+d x+\frac {\pi }{2}\right )}{\sqrt {a-b \tan \left (c+d x+\frac {\pi }{2}\right )}}dx-\frac {1}{2} (a-i b) \int \frac {i \tan \left (c+d x+\frac {\pi }{2}\right )+1}{\sqrt {a-b \tan \left (c+d x+\frac {\pi }{2}\right )}}dx\)

\(\Big \downarrow \) 4020

\(\displaystyle \frac {i (a+i b) \int -\frac {1}{(1-i \cot (c+d x)) \sqrt {a+b \cot (c+d x)}}d(i \cot (c+d x))}{2 d}-\frac {i (a-i b) \int -\frac {1}{(i \cot (c+d x)+1) \sqrt {a+b \cot (c+d x)}}d(-i \cot (c+d x))}{2 d}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {i (a-i b) \int \frac {1}{(i \cot (c+d x)+1) \sqrt {a+b \cot (c+d x)}}d(-i \cot (c+d x))}{2 d}-\frac {i (a+i b) \int \frac {1}{(1-i \cot (c+d x)) \sqrt {a+b \cot (c+d x)}}d(i \cot (c+d x))}{2 d}\)

\(\Big \downarrow \) 73

\(\displaystyle \frac {(a-i b) \int \frac {1}{-\frac {i \cot ^2(c+d x)}{b}-\frac {i a}{b}+1}d\sqrt {a+b \cot (c+d x)}}{b d}+\frac {(a+i b) \int \frac {1}{\frac {i \cot ^2(c+d x)}{b}+\frac {i a}{b}+1}d\sqrt {a+b \cot (c+d x)}}{b d}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {(a+i b) \arctan \left (\frac {\cot (c+d x)}{\sqrt {a-i b}}\right )}{d \sqrt {a-i b}}+\frac {(a-i b) \arctan \left (\frac {\cot (c+d x)}{\sqrt {a+i b}}\right )}{d \sqrt {a+i b}}\)

Input:

Int[(-a + b*Cot[c + d*x])/Sqrt[a + b*Cot[c + d*x]],x]
 

Output:

((a + I*b)*ArcTan[Cot[c + d*x]/Sqrt[a - I*b]])/(Sqrt[a - I*b]*d) + ((a - I 
*b)*ArcTan[Cot[c + d*x]/Sqrt[a + I*b]])/(Sqrt[a + I*b]*d)
 

Defintions of rubi rules used

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

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 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 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4020
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[c*(d/f)   Subst[Int[(a + (b/d)*x)^m/(d^2 + 
c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[ 
b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]
 

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

Leaf count of result is larger than twice the leaf count of optimal. \(1899\) vs. \(2(84)=168\).

Time = 0.47 (sec) , antiderivative size = 1900, normalized size of antiderivative = 18.63

method result size
parts \(\text {Expression too large to display}\) \(1900\)
derivativedivides \(\text {Expression too large to display}\) \(1905\)
default \(\text {Expression too large to display}\) \(1905\)

Input:

int((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))^(1/2),x,method=_RETURNVERBOSE)
 

Output:

b/d*(-1/2/(a^2+b^2)^(1/2)*(-1/2*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*ln(b*cot(d*x 
+c)+a+(a+b*cot(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)+(a^2+b^2)^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^(1/2)/(2 
*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan((2*(a+b*cot(d*x+c))^(1/2)+(2*(a^2+b^2)^ 
(1/2)+2*a)^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*a^2+1/d*b/(a^2+b^2)^(1/2) 
/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan((2*(a+b*cot(d*x+c))^(1/2)+(2*(a^2+b^ 
2)^(1/2)+2*a)^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))-1/d/b/(a^2+b^2)^(3/...
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1219 vs. \(2 (75) = 150\).

Time = 0.11 (sec) , antiderivative size = 1219, normalized size of antiderivative = 11.95 \[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=\text {Too large to display} \] Input:

integrate((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))^(1/2),x, algorithm="fricas")
 

Output:

-1/2*sqrt(-((a^2 + b^2)*d^2*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 2* 
a^2*b^2 + b^4)*d^4)) + a^3 - 3*a*b^2)/((a^2 + b^2)*d^2))*log(-(3*a^4*b + 2 
*a^2*b^3 - b^5)*sqrt((b*cos(2*d*x + 2*c) + a*sin(2*d*x + 2*c) + b)/sin(2*d 
*x + 2*c)) + ((a^4 - b^4)*d^3*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 
2*a^2*b^2 + b^4)*d^4)) + 2*(3*a^3*b^2 - a*b^4)*d)*sqrt(-((a^2 + b^2)*d^2*s 
qrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4)*d^4)) + a^3 - 
3*a*b^2)/((a^2 + b^2)*d^2))) + 1/2*sqrt(-((a^2 + b^2)*d^2*sqrt(-(9*a^4*b^2 
 - 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4)*d^4)) + a^3 - 3*a*b^2)/((a^2 
+ b^2)*d^2))*log(-(3*a^4*b + 2*a^2*b^3 - b^5)*sqrt((b*cos(2*d*x + 2*c) + a 
*sin(2*d*x + 2*c) + b)/sin(2*d*x + 2*c)) - ((a^4 - b^4)*d^3*sqrt(-(9*a^4*b 
^2 - 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4)*d^4)) + 2*(3*a^3*b^2 - a*b^ 
4)*d)*sqrt(-((a^2 + b^2)*d^2*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 2 
*a^2*b^2 + b^4)*d^4)) + a^3 - 3*a*b^2)/((a^2 + b^2)*d^2))) + 1/2*sqrt(((a^ 
2 + b^2)*d^2*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4)* 
d^4)) - a^3 + 3*a*b^2)/((a^2 + b^2)*d^2))*log(-(3*a^4*b + 2*a^2*b^3 - b^5) 
*sqrt((b*cos(2*d*x + 2*c) + a*sin(2*d*x + 2*c) + b)/sin(2*d*x + 2*c)) + (( 
a^4 - b^4)*d^3*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4 
)*d^4)) - 2*(3*a^3*b^2 - a*b^4)*d)*sqrt(((a^2 + b^2)*d^2*sqrt(-(9*a^4*b^2 
- 6*a^2*b^4 + b^6)/((a^4 + 2*a^2*b^2 + b^4)*d^4)) - a^3 + 3*a*b^2)/((a^2 + 
 b^2)*d^2))) - 1/2*sqrt(((a^2 + b^2)*d^2*sqrt(-(9*a^4*b^2 - 6*a^2*b^4 +...
 

Sympy [F]

\[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=- \int \frac {a}{\sqrt {a + b \cot {\left (c + d x \right )}}}\, dx - \int \left (- \frac {b \cot {\left (c + d x \right )}}{\sqrt {a + b \cot {\left (c + d x \right )}}}\right )\, dx \] Input:

integrate((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))**(1/2),x)
 

Output:

-Integral(a/sqrt(a + b*cot(c + d*x)), x) - Integral(-b*cot(c + d*x)/sqrt(a 
 + b*cot(c + d*x)), x)
 

Maxima [F]

\[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=\int { \frac {b \cot \left (d x + c\right ) - a}{\sqrt {b \cot \left (d x + c\right ) + a}} \,d x } \] Input:

integrate((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))^(1/2),x, algorithm="maxima")
                                                                                    
                                                                                    
 

Output:

integrate((b*cot(d*x + c) - a)/sqrt(b*cot(d*x + c) + a), x)
 

Giac [F]

\[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=\int { \frac {b \cot \left (d x + c\right ) - a}{\sqrt {b \cot \left (d x + c\right ) + a}} \,d x } \] Input:

integrate((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))^(1/2),x, algorithm="giac")
 

Output:

integrate((b*cot(d*x + c) - a)/sqrt(b*cot(d*x + c) + a), x)
 

Mupad [B] (verification not implemented)

Time = 10.90 (sec) , antiderivative size = 2731, normalized size of antiderivative = 26.77 \[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=\text {Too large to display} \] Input:

int(-(a - b*cot(c + d*x))/(a + b*cot(c + d*x))^(1/2),x)
 

Output:

2*atanh((32*a^4*b^2*d^2*(- (-16*a^4*b^2*d^4)^(1/2)/(16*(a^2*d^4 + b^2*d^4) 
) - (a^3*d^2)/(4*(a^2*d^4 + b^2*d^4)))^(1/2)*(a + b*cot(c + d*x))^(1/2))/( 
(16*a^4*b^5*d^5)/(a^2*d^4 + b^2*d^4) + (16*a^6*b^3*d^5)/(a^2*d^4 + b^2*d^4 
) + (4*a^3*b^3*d^4*(-16*a^4*b^2*d^4)^(1/2))/(a^2*d^5 + b^2*d^5) + (4*a*b^5 
*d^4*(-16*a^4*b^2*d^4)^(1/2))/(a^2*d^5 + b^2*d^5)) - (32*a^2*b^2*(- (-16*a 
^4*b^2*d^4)^(1/2)/(16*(a^2*d^4 + b^2*d^4)) - (a^3*d^2)/(4*(a^2*d^4 + b^2*d 
^4)))^(1/2)*(a + b*cot(c + d*x))^(1/2))/((16*a^4*b^3*d^3)/(a^2*d^4 + b^2*d 
^4) + (4*a*b^3*d^2*(-16*a^4*b^2*d^4)^(1/2))/(a^2*d^5 + b^2*d^5)) + (8*a*b^ 
2*(- (-16*a^4*b^2*d^4)^(1/2)/(16*(a^2*d^4 + b^2*d^4)) - (a^3*d^2)/(4*(a^2* 
d^4 + b^2*d^4)))^(1/2)*(a + b*cot(c + d*x))^(1/2)*(-16*a^4*b^2*d^4)^(1/2)) 
/((16*a^4*b^5*d^5)/(a^2*d^4 + b^2*d^4) + (16*a^6*b^3*d^5)/(a^2*d^4 + b^2*d 
^4) + (4*a^3*b^3*d^4*(-16*a^4*b^2*d^4)^(1/2))/(a^2*d^5 + b^2*d^5) + (4*a*b 
^5*d^4*(-16*a^4*b^2*d^4)^(1/2))/(a^2*d^5 + b^2*d^5)))*(- (-16*a^4*b^2*d^4) 
^(1/2)/(16*(a^2*d^4 + b^2*d^4)) - (a^3*d^2)/(4*(a^2*d^4 + b^2*d^4)))^(1/2) 
 - 2*atanh((32*a^2*b^2*((-16*a^4*b^2*d^4)^(1/2)/(16*(a^2*d^4 + b^2*d^4)) - 
 (a^3*d^2)/(4*(a^2*d^4 + b^2*d^4)))^(1/2)*(a + b*cot(c + d*x))^(1/2))/((16 
*a^4*b^3*d^3)/(a^2*d^4 + b^2*d^4) - (4*a*b^3*d^2*(-16*a^4*b^2*d^4)^(1/2))/ 
(a^2*d^5 + b^2*d^5)) - (32*a^4*b^2*d^2*((-16*a^4*b^2*d^4)^(1/2)/(16*(a^2*d 
^4 + b^2*d^4)) - (a^3*d^2)/(4*(a^2*d^4 + b^2*d^4)))^(1/2)*(a + b*cot(c + d 
*x))^(1/2))/((16*a^4*b^5*d^5)/(a^2*d^4 + b^2*d^4) + (16*a^6*b^3*d^5)/(a...
 

Reduce [F]

\[ \int \frac {-a+b \cot (c+d x)}{\sqrt {a+b \cot (c+d x)}} \, dx=-\left (\int \frac {\sqrt {\cot \left (d x +c \right ) b +a}}{\cot \left (d x +c \right ) b +a}d x \right ) a +\left (\int \frac {\sqrt {\cot \left (d x +c \right ) b +a}\, \cot \left (d x +c \right )}{\cot \left (d x +c \right ) b +a}d x \right ) b \] Input:

int((-a+b*cot(d*x+c))/(a+b*cot(d*x+c))^(1/2),x)
 

Output:

 - int(sqrt(cot(c + d*x)*b + a)/(cot(c + d*x)*b + a),x)*a + int((sqrt(cot( 
c + d*x)*b + a)*cot(c + d*x))/(cot(c + d*x)*b + a),x)*b