\(\int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx\) [89]

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

Optimal result

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

-2*a^(1/2)*arctanh((a+I*a*tan(d*x+c))^(1/2)/a^(1/2))/d+2^(1/2)*a^(1/2)*arc 
tanh(1/2*(a+I*a*tan(d*x+c))^(1/2)*2^(1/2)/a^(1/2))/d
 

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 71, normalized size of antiderivative = 0.91 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=\frac {\sqrt {a} \left (-2 \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )+\sqrt {2} \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )\right )}{d} \] Input:

Integrate[Cot[c + d*x]*Sqrt[a + I*a*Tan[c + d*x]],x]
 

Output:

(Sqrt[a]*(-2*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/Sqrt[a]] + Sqrt[2]*ArcTanh 
[Sqrt[a + I*a*Tan[c + d*x]]/(Sqrt[2]*Sqrt[a])]))/d
 

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4045, 3042, 3961, 219, 4082, 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 (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sqrt {a+i a \tan (c+d x)}}{\tan (c+d x)}dx\)

\(\Big \downarrow \) 4045

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

\(\Big \downarrow \) 3042

\(\displaystyle i \int \sqrt {i \tan (c+d x) a+a}dx-\frac {i \int \frac {\sqrt {i \tan (c+d x) a+a} (\tan (c+d x) a+i a)}{\tan (c+d x)}dx}{a}\)

\(\Big \downarrow \) 3961

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

\(\Big \downarrow \) 219

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

\(\Big \downarrow \) 4082

\(\displaystyle \frac {a \int \frac {\cot (c+d x)}{\sqrt {i \tan (c+d x) a+a}}d\tan (c+d x)}{d}+\frac {\sqrt {2} \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d}\)

\(\Big \downarrow \) 73

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

\(\Big \downarrow \) 221

\(\displaystyle \frac {\sqrt {2} \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d}-\frac {2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )}{d}\)

Input:

Int[Cot[c + d*x]*Sqrt[a + I*a*Tan[c + d*x]],x]
 

Output:

(-2*Sqrt[a]*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/Sqrt[a]])/d + (Sqrt[2]*Sqrt 
[a]*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/(Sqrt[2]*Sqrt[a])])/d
 

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 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

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 3961
Int[Sqrt[(a_) + (b_.)*tan[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[-2*(b/d) 
  Subst[Int[1/(2*a - x^2), x], x, Sqrt[a + b*Tan[c + d*x]]], x] /; FreeQ[{a 
, b, c, d}, x] && EqQ[a^2 + b^2, 0]
 

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

rule 4082
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[b*(B/f)   Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^n, x], x, Tan[e + f*x]], 
x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[ 
a^2 + b^2, 0] && EqQ[A*b + a*B, 0]
 
Maple [B] (warning: unable to verify)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 209 vs. \(2 (61 ) = 122\).

Time = 9.15 (sec) , antiderivative size = 210, normalized size of antiderivative = 2.69

method result size
default \(-\frac {\sqrt {a \left (1+i \tan \left (d x +c \right )\right )}\, \sqrt {-\frac {2 \cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \left (\sqrt {2}\, \arctan \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {2}}{2}\right )+\arctan \left (\frac {\sqrt {2}}{2 \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}}\right )-i \sqrt {2}\, \operatorname {arctanh}\left (\frac {\left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right ) \sqrt {2}}{\sqrt {\csc \left (d x +c \right )^{2} \left (1-\cos \left (d x +c \right )\right )^{2}-1}}\right )+i \ln \left (\sqrt {-\frac {2 \cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right )\right )}{d \left (i \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )+1\right )}\) \(210\)

Input:

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

Output:

-1/d/(I*(csc(d*x+c)-cot(d*x+c))+1)*(a*(1+I*tan(d*x+c)))^(1/2)*(-2*cos(d*x+ 
c)/(cos(d*x+c)+1))^(1/2)*(2^(1/2)*arctan(1/2*(-2*cos(d*x+c)/(cos(d*x+c)+1) 
)^(1/2)*2^(1/2))+arctan(1/2*2^(1/2)/(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2))-I* 
2^(1/2)*arctanh(1/(csc(d*x+c)^2*(1-cos(d*x+c))^2-1)^(1/2)*(csc(d*x+c)-cot( 
d*x+c))*2^(1/2))+I*ln((-2*cos(d*x+c)/(cos(d*x+c)+1))^(1/2)-cot(d*x+c)+csc( 
d*x+c)))
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 336 vs. \(2 (59) = 118\).

Time = 0.08 (sec) , antiderivative size = 336, normalized size of antiderivative = 4.31 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=\frac {1}{2} \, \sqrt {2} \sqrt {\frac {a}{d^{2}}} \log \left (4 \, {\left ({\left (d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {a}{d^{2}}} + a e^{\left (i \, d x + i \, c\right )}\right )} e^{\left (-i \, d x - i \, c\right )}\right ) - \frac {1}{2} \, \sqrt {2} \sqrt {\frac {a}{d^{2}}} \log \left (-4 \, {\left ({\left (d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {a}{d^{2}}} - a e^{\left (i \, d x + i \, c\right )}\right )} e^{\left (-i \, d x - i \, c\right )}\right ) - \frac {1}{2} \, \sqrt {\frac {a}{d^{2}}} \log \left (16 \, {\left (3 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + 2 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {a}{d^{2}}} + a^{2}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}\right ) + \frac {1}{2} \, \sqrt {\frac {a}{d^{2}}} \log \left (16 \, {\left (3 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {a}{d^{2}}} + a^{2}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}\right ) \] Input:

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

Output:

1/2*sqrt(2)*sqrt(a/d^2)*log(4*((d*e^(2*I*d*x + 2*I*c) + d)*sqrt(a/(e^(2*I* 
d*x + 2*I*c) + 1))*sqrt(a/d^2) + a*e^(I*d*x + I*c))*e^(-I*d*x - I*c)) - 1/ 
2*sqrt(2)*sqrt(a/d^2)*log(-4*((d*e^(2*I*d*x + 2*I*c) + d)*sqrt(a/(e^(2*I*d 
*x + 2*I*c) + 1))*sqrt(a/d^2) - a*e^(I*d*x + I*c))*e^(-I*d*x - I*c)) - 1/2 
*sqrt(a/d^2)*log(16*(3*a^2*e^(2*I*d*x + 2*I*c) + 2*sqrt(2)*(a*d*e^(3*I*d*x 
 + 3*I*c) + a*d*e^(I*d*x + I*c))*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1))*sqrt(a/ 
d^2) + a^2)*e^(-2*I*d*x - 2*I*c)) + 1/2*sqrt(a/d^2)*log(16*(3*a^2*e^(2*I*d 
*x + 2*I*c) - 2*sqrt(2)*(a*d*e^(3*I*d*x + 3*I*c) + a*d*e^(I*d*x + I*c))*sq 
rt(a/(e^(2*I*d*x + 2*I*c) + 1))*sqrt(a/d^2) + a^2)*e^(-2*I*d*x - 2*I*c))
 

Sympy [F]

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

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))**(1/2),x)
 

Output:

Integral(sqrt(I*a*(tan(c + d*x) - I))*cot(c + d*x), x)
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.37 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=-\frac {\sqrt {2} \sqrt {a} \log \left (-\frac {\sqrt {2} \sqrt {a} - \sqrt {i \, a \tan \left (d x + c\right ) + a}}{\sqrt {2} \sqrt {a} + \sqrt {i \, a \tan \left (d x + c\right ) + a}}\right ) - 2 \, \sqrt {a} \log \left (\frac {\sqrt {i \, a \tan \left (d x + c\right ) + a} - \sqrt {a}}{\sqrt {i \, a \tan \left (d x + c\right ) + a} + \sqrt {a}}\right )}{2 \, d} \] Input:

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

Output:

-1/2*(sqrt(2)*sqrt(a)*log(-(sqrt(2)*sqrt(a) - sqrt(I*a*tan(d*x + c) + a))/ 
(sqrt(2)*sqrt(a) + sqrt(I*a*tan(d*x + c) + a))) - 2*sqrt(a)*log((sqrt(I*a* 
tan(d*x + c) + a) - sqrt(a))/(sqrt(I*a*tan(d*x + c) + a) + sqrt(a))))/d
 

Giac [F(-2)]

Exception generated. \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=\text {Exception raised: TypeError} \] Input:

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^(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 TypeError: Bad 
Argument TypeDone
 

Mupad [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.78 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=-\frac {2\,\sqrt {a}\,\mathrm {atanh}\left (\frac {\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{\sqrt {a}}\right )}{d}+\frac {\sqrt {2}\,\sqrt {a}\,\mathrm {atanh}\left (\frac {\sqrt {2}\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {a}}\right )}{d} \] Input:

int(cot(c + d*x)*(a + a*tan(c + d*x)*1i)^(1/2),x)
 

Output:

(2^(1/2)*a^(1/2)*atanh((2^(1/2)*(a + a*tan(c + d*x)*1i)^(1/2))/(2*a^(1/2)) 
))/d - (2*a^(1/2)*atanh((a + a*tan(c + d*x)*1i)^(1/2)/a^(1/2)))/d
 

Reduce [F]

\[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} \, dx=\sqrt {a}\, \left (\int \sqrt {\tan \left (d x +c \right ) i +1}\, \cot \left (d x +c \right )d x \right ) \] Input:

int(cot(d*x+c)*(a+I*a*tan(d*x+c))^(1/2),x)
 

Output:

sqrt(a)*int(sqrt(tan(c + d*x)*i + 1)*cot(c + d*x),x)