\(\int \log (a \tan (x)) \, dx\) [167]

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

Optimal result

Integrand size = 5, antiderivative size = 51 \[ \int \log (a \tan (x)) \, dx=2 x \text {arctanh}\left (e^{2 i x}\right )+x \log (a \tan (x))-\frac {1}{2} i \operatorname {PolyLog}\left (2,-e^{2 i x}\right )+\frac {1}{2} i \operatorname {PolyLog}\left (2,e^{2 i x}\right ) \] Output:

2*x*arctanh(exp(2*I*x))+x*ln(a*tan(x))-1/2*I*polylog(2,-exp(2*I*x))+1/2*I* 
polylog(2,exp(2*I*x))
 

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.47 \[ \int \log (a \tan (x)) \, dx=-\frac {1}{2} i \log (-i (i-\tan (x))) \log (a \tan (x))+\frac {1}{2} i \log (a \tan (x)) \log (-i (i+\tan (x)))-\frac {1}{2} i \operatorname {PolyLog}(2,-i \tan (x))+\frac {1}{2} i \operatorname {PolyLog}(2,i \tan (x)) \] Input:

Integrate[Log[a*Tan[x]],x]
 

Output:

(-1/2*I)*Log[(-I)*(I - Tan[x])]*Log[a*Tan[x]] + (I/2)*Log[a*Tan[x]]*Log[(- 
I)*(I + Tan[x])] - (I/2)*PolyLog[2, (-I)*Tan[x]] + (I/2)*PolyLog[2, I*Tan[ 
x]]
 

Rubi [A] (verified)

Time = 0.35 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.06, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.200, Rules used = {3028, 4919, 3042, 4671, 2715, 2838}

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 \log (a \tan (x)) \, dx\)

\(\Big \downarrow \) 3028

\(\displaystyle x \log (a \tan (x))-\int x \csc (x) \sec (x)dx\)

\(\Big \downarrow \) 4919

\(\displaystyle x \log (a \tan (x))-2 \int x \csc (2 x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle x \log (a \tan (x))-2 \int x \csc (2 x)dx\)

\(\Big \downarrow \) 4671

\(\displaystyle x \log (a \tan (x))-2 \left (-\frac {1}{2} \int \log \left (1-e^{2 i x}\right )dx+\frac {1}{2} \int \log \left (1+e^{2 i x}\right )dx-x \text {arctanh}\left (e^{2 i x}\right )\right )\)

\(\Big \downarrow \) 2715

\(\displaystyle x \log (a \tan (x))-2 \left (\frac {1}{4} i \int e^{-2 i x} \log \left (1-e^{2 i x}\right )de^{2 i x}-\frac {1}{4} i \int e^{-2 i x} \log \left (1+e^{2 i x}\right )de^{2 i x}-x \text {arctanh}\left (e^{2 i x}\right )\right )\)

\(\Big \downarrow \) 2838

\(\displaystyle x \log (a \tan (x))-2 \left (-x \text {arctanh}\left (e^{2 i x}\right )+\frac {1}{4} i \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} i \operatorname {PolyLog}\left (2,e^{2 i x}\right )\right )\)

Input:

Int[Log[a*Tan[x]],x]
 

Output:

x*Log[a*Tan[x]] - 2*(-(x*ArcTanh[E^((2*I)*x)]) + (I/4)*PolyLog[2, -E^((2*I 
)*x)] - (I/4)*PolyLog[2, E^((2*I)*x)])
 

Defintions of rubi rules used

rule 2715
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] 
:> Simp[1/(d*e*n*Log[F])   Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) 
))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

rule 3028
Int[Log[u_], x_Symbol] :> Simp[x*Log[u], x] - Int[SimplifyIntegrand[x*(D[u, 
 x]/u), x], x] /; InverseFunctionFreeQ[u, x]
 

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

rule 4671
Int[csc[(e_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[- 
2*(c + d*x)^m*(ArcTanh[E^(I*(e + f*x))]/f), x] + (-Simp[d*(m/f)   Int[(c + 
d*x)^(m - 1)*Log[1 - E^(I*(e + f*x))], x], x] + Simp[d*(m/f)   Int[(c + d*x 
)^(m - 1)*Log[1 + E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e, f}, x] && IG 
tQ[m, 0]
 

rule 4919
Int[Csc[(a_.) + (b_.)*(x_)]^(n_.)*((c_.) + (d_.)*(x_))^(m_.)*Sec[(a_.) + (b 
_.)*(x_)]^(n_.), x_Symbol] :> Simp[2^n   Int[(c + d*x)^m*Csc[2*a + 2*b*x]^n 
, x], x] /; FreeQ[{a, b, c, d, m}, x] && IntegerQ[n] && RationalQ[m]
 
Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (39 ) = 78\).

Time = 0.48 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.67

method result size
derivativedivides \(a \left (-\frac {i \ln \left (a \tan \left (x \right )\right ) \left (\ln \left (\frac {i a \tan \left (x \right )+a}{a}\right )-\ln \left (-\frac {i a \tan \left (x \right )-a}{a}\right )\right )}{2 a}-\frac {i \left (\operatorname {dilog}\left (\frac {i a \tan \left (x \right )+a}{a}\right )-\operatorname {dilog}\left (-\frac {i a \tan \left (x \right )-a}{a}\right )\right )}{2 a}\right )\) \(85\)
default \(a \left (-\frac {i \ln \left (a \tan \left (x \right )\right ) \left (\ln \left (\frac {i a \tan \left (x \right )+a}{a}\right )-\ln \left (-\frac {i a \tan \left (x \right )-a}{a}\right )\right )}{2 a}-\frac {i \left (\operatorname {dilog}\left (\frac {i a \tan \left (x \right )+a}{a}\right )-\operatorname {dilog}\left (-\frac {i a \tan \left (x \right )-a}{a}\right )\right )}{2 a}\right )\) \(85\)
risch \(-x \ln \left (1+{\mathrm e}^{2 i x}\right )-\frac {i \pi {\operatorname {csgn}\left (\frac {a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{3} x}{2}-\frac {i \pi \,\operatorname {csgn}\left (i a \right ) \operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) \operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) x}{2}-\frac {i \pi {\operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{3} x}{2}-\frac {i \pi \,\operatorname {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \operatorname {csgn}\left (\frac {i}{1+{\mathrm e}^{2 i x}}\right ) \operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) x}{2}-i \ln \left ({\mathrm e}^{i x}\right ) \ln \left ({\mathrm e}^{2 i x}-1\right )-i \operatorname {dilog}\left (1-i {\mathrm e}^{i x}\right )+x \ln \left (a \right )+\frac {i \pi \,\operatorname {csgn}\left (i a \right ) {\operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}+\frac {i \pi \,\operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) {\operatorname {csgn}\left (\frac {a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}-i \operatorname {dilog}\left ({\mathrm e}^{i x}\right )+\frac {i \pi \,\operatorname {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) {\operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}+x \ln \left (1+i {\mathrm e}^{i x}\right )+x \ln \left (1-i {\mathrm e}^{i x}\right )-i \operatorname {dilog}\left (1+i {\mathrm e}^{i x}\right )+\frac {i \pi {\operatorname {csgn}\left (\frac {a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}+\frac {i \pi \,\operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) {\operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}-\frac {i \pi x}{2}+i \operatorname {dilog}\left ({\mathrm e}^{i x}+1\right )-\frac {i \pi {\operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{3} x}{2}+i \ln \left ({\mathrm e}^{i x}\right ) \ln \left ({\mathrm e}^{i x}+1\right )+\frac {i \pi \,\operatorname {csgn}\left (\frac {i}{1+{\mathrm e}^{2 i x}}\right ) {\operatorname {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right )}^{2} x}{2}-\frac {i \pi \,\operatorname {csgn}\left (\frac {i a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) \operatorname {csgn}\left (\frac {a \left ({\mathrm e}^{2 i x}-1\right )}{1+{\mathrm e}^{2 i x}}\right ) x}{2}\) \(588\)

Input:

int(ln(a*tan(x)),x,method=_RETURNVERBOSE)
 

Output:

a*(-1/2*I*ln(a*tan(x))*(ln((I*a*tan(x)+a)/a)-ln(-(I*a*tan(x)-a)/a))/a-1/2* 
I*(dilog((I*a*tan(x)+a)/a)-dilog(-(I*a*tan(x)-a)/a))/a)
 

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. 184 vs. \(2 (32) = 64\).

Time = 0.09 (sec) , antiderivative size = 184, normalized size of antiderivative = 3.61 \[ \int \log (a \tan (x)) \, dx=x \log \left (a \tan \left (x\right )\right ) - \frac {1}{2} \, x \log \left (\frac {2 \, {\left (\tan \left (x\right )^{2} + i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac {1}{2} \, x \log \left (\frac {2 \, {\left (\tan \left (x\right )^{2} - i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1}\right ) + \frac {1}{2} \, x \log \left (-\frac {2 \, {\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) + \frac {1}{2} \, x \log \left (-\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac {1}{4} i \, {\rm Li}_2\left (-\frac {2 \, {\left (\tan \left (x\right )^{2} + i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) + \frac {1}{4} i \, {\rm Li}_2\left (-\frac {2 \, {\left (\tan \left (x\right )^{2} - i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) + \frac {1}{4} i \, {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) - \frac {1}{4} i \, {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) \] Input:

integrate(log(a*tan(x)),x, algorithm="fricas")
 

Output:

x*log(a*tan(x)) - 1/2*x*log(2*(tan(x)^2 + I*tan(x))/(tan(x)^2 + 1)) - 1/2* 
x*log(2*(tan(x)^2 - I*tan(x))/(tan(x)^2 + 1)) + 1/2*x*log(-2*(I*tan(x) - 1 
)/(tan(x)^2 + 1)) + 1/2*x*log(-2*(-I*tan(x) - 1)/(tan(x)^2 + 1)) - 1/4*I*d 
ilog(-2*(tan(x)^2 + I*tan(x))/(tan(x)^2 + 1) + 1) + 1/4*I*dilog(-2*(tan(x) 
^2 - I*tan(x))/(tan(x)^2 + 1) + 1) + 1/4*I*dilog(2*(I*tan(x) - 1)/(tan(x)^ 
2 + 1) + 1) - 1/4*I*dilog(2*(-I*tan(x) - 1)/(tan(x)^2 + 1) + 1)
 

Sympy [F]

\[ \int \log (a \tan (x)) \, dx=\int \log {\left (a \tan {\left (x \right )} \right )}\, dx \] Input:

integrate(ln(a*tan(x)),x)
 

Output:

Integral(log(a*tan(x)), x)
 

Maxima [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.82 \[ \int \log (a \tan (x)) \, dx=x \log \left (a \tan \left (x\right )\right ) + \frac {1}{4} \, \pi \log \left (\tan \left (x\right )^{2} + 1\right ) - x \log \left (\tan \left (x\right )\right ) + \frac {1}{2} i \, {\rm Li}_2\left (i \, \tan \left (x\right ) + 1\right ) - \frac {1}{2} i \, {\rm Li}_2\left (-i \, \tan \left (x\right ) + 1\right ) \] Input:

integrate(log(a*tan(x)),x, algorithm="maxima")
 

Output:

x*log(a*tan(x)) + 1/4*pi*log(tan(x)^2 + 1) - x*log(tan(x)) + 1/2*I*dilog(I 
*tan(x) + 1) - 1/2*I*dilog(-I*tan(x) + 1)
 

Giac [F]

\[ \int \log (a \tan (x)) \, dx=\int { \log \left (a \tan \left (x\right )\right ) \,d x } \] Input:

integrate(log(a*tan(x)),x, algorithm="giac")
 

Output:

integrate(log(a*tan(x)), x)
 

Mupad [B] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.76 \[ \int \log (a \tan (x)) \, dx=2\,x\,\mathrm {atanh}\left ({\mathrm {e}}^{x\,2{}\mathrm {i}}\right )+x\,\ln \left (a\,\mathrm {tan}\left (x\right )\right )-\frac {\mathrm {polylog}\left (2,-{\mathrm {e}}^{x\,2{}\mathrm {i}}\right )\,1{}\mathrm {i}}{2}+\frac {\mathrm {polylog}\left (2,{\mathrm {e}}^{x\,2{}\mathrm {i}}\right )\,1{}\mathrm {i}}{2} \] Input:

int(log(a*tan(x)),x)
 

Output:

2*x*atanh(exp(x*2i)) - (polylog(2, -exp(x*2i))*1i)/2 + (polylog(2, exp(x*2 
i))*1i)/2 + x*log(a*tan(x))
 

Reduce [F]

\[ \int \log (a \tan (x)) \, dx=\int \mathrm {log}\left (\tan \left (x \right ) a \right )d x \] Input:

int(log(a*tan(x)),x)
 

Output:

int(log(tan(x)*a),x)