\(\int \log (a \tan ^2(x)) \, dx\) [168]

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

Optimal result

Integrand size = 7, antiderivative size = 49 \[ \int \log \left (a \tan ^2(x)\right ) \, dx=4 x \text {arctanh}\left (e^{2 i x}\right )+x \log \left (a \tan ^2(x)\right )-i \operatorname {PolyLog}\left (2,-e^{2 i x}\right )+i \operatorname {PolyLog}\left (2,e^{2 i x}\right ) \]

[Out]

4*x*arctanh(exp(2*I*x))+x*ln(a*tan(x)^2)-I*polylog(2,-exp(2*I*x))+I*polylog(2,exp(2*I*x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.857, Rules used = {2628, 12, 4504, 4268, 2317, 2438} \[ \int \log \left (a \tan ^2(x)\right ) \, dx=x \log \left (a \tan ^2(x)\right )+4 x \text {arctanh}\left (e^{2 i x}\right )-i \operatorname {PolyLog}\left (2,-e^{2 i x}\right )+i \operatorname {PolyLog}\left (2,e^{2 i x}\right ) \]

[In]

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

[Out]

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

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[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 2438

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 2628

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

Rule 4268

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] + (-Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Log[1 - E^(I*(e + f*x))], x], x] + Dist[d*(m/f), Int[(c +
d*x)^(m - 1)*Log[1 + E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e, f}, x] && IGtQ[m, 0]

Rule 4504

Int[Csc[(a_.) + (b_.)*(x_)]^(n_.)*((c_.) + (d_.)*(x_))^(m_.)*Sec[(a_.) + (b_.)*(x_)]^(n_.), x_Symbol] :> Dist[
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]

Rubi steps \begin{align*} \text {integral}& = x \log \left (a \tan ^2(x)\right )-\int 2 x \csc (x) \sec (x) \, dx \\ & = x \log \left (a \tan ^2(x)\right )-2 \int x \csc (x) \sec (x) \, dx \\ & = x \log \left (a \tan ^2(x)\right )-4 \int x \csc (2 x) \, dx \\ & = 4 x \tanh ^{-1}\left (e^{2 i x}\right )+x \log \left (a \tan ^2(x)\right )+2 \int \log \left (1-e^{2 i x}\right ) \, dx-2 \int \log \left (1+e^{2 i x}\right ) \, dx \\ & = 4 x \tanh ^{-1}\left (e^{2 i x}\right )+x \log \left (a \tan ^2(x)\right )-i \text {Subst}\left (\int \frac {\log (1-x)}{x} \, dx,x,e^{2 i x}\right )+i \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i x}\right ) \\ & = 4 x \tanh ^{-1}\left (e^{2 i x}\right )+x \log \left (a \tan ^2(x)\right )-i \text {Li}_2\left (-e^{2 i x}\right )+i \text {Li}_2\left (e^{2 i x}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.53 \[ \int \log \left (a \tan ^2(x)\right ) \, dx=-\frac {1}{2} i \log (-i (i-\tan (x))) \log \left (a \tan ^2(x)\right )+\frac {1}{2} i \log \left (a \tan ^2(x)\right ) \log (-i (i+\tan (x)))-i \operatorname {PolyLog}(2,-i \tan (x))+i \operatorname {PolyLog}(2,i \tan (x)) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 1.14 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.67

method result size
derivativedivides \(-\frac {i \left (\ln \left (\tan \left (x \right )-i\right ) \ln \left (a \left (\tan ^{2}\left (x \right )\right )\right )-2 \operatorname {dilog}\left (-i \tan \left (x \right )\right )-2 \ln \left (\tan \left (x \right )-i\right ) \ln \left (-i \tan \left (x \right )\right )\right )}{2}+\frac {i \left (\ln \left (\tan \left (x \right )+i\right ) \ln \left (a \left (\tan ^{2}\left (x \right )\right )\right )-2 \operatorname {dilog}\left (i \tan \left (x \right )\right )-2 \ln \left (\tan \left (x \right )+i\right ) \ln \left (i \tan \left (x \right )\right )\right )}{2}\) \(82\)
default \(-\frac {i \left (\ln \left (\tan \left (x \right )-i\right ) \ln \left (a \left (\tan ^{2}\left (x \right )\right )\right )-2 \operatorname {dilog}\left (-i \tan \left (x \right )\right )-2 \ln \left (\tan \left (x \right )-i\right ) \ln \left (-i \tan \left (x \right )\right )\right )}{2}+\frac {i \left (\ln \left (\tan \left (x \right )+i\right ) \ln \left (a \left (\tan ^{2}\left (x \right )\right )\right )-2 \operatorname {dilog}\left (i \tan \left (x \right )\right )-2 \ln \left (\tan \left (x \right )+i\right ) \ln \left (i \tan \left (x \right )\right )\right )}{2}\) \(82\)
risch \(\text {Expression too large to display}\) \(664\)

[In]

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

[Out]

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

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 (34) = 68\).

Time = 0.32 (sec) , antiderivative size = 184, normalized size of antiderivative = 3.76 \[ \int \log \left (a \tan ^2(x)\right ) \, dx=x \log \left (a \tan \left (x\right )^{2}\right ) - x \log \left (\frac {2 \, {\left (\tan \left (x\right )^{2} + i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1}\right ) - x \log \left (\frac {2 \, {\left (\tan \left (x\right )^{2} - i \, \tan \left (x\right )\right )}}{\tan \left (x\right )^{2} + 1}\right ) + x \log \left (-\frac {2 \, {\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) + x \log \left (-\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac {1}{2} 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}{2} 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}{2} 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}{2} i \, {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) \]

[In]

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

[Out]

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

Sympy [F]

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.90 \[ \int \log \left (a \tan ^2(x)\right ) \, dx=x \log \left (a \tan \left (x\right )^{2}\right ) + \frac {1}{2} \, \pi \log \left (\tan \left (x\right )^{2} + 1\right ) - 2 \, x \log \left (\tan \left (x\right )\right ) + i \, {\rm Li}_2\left (i \, \tan \left (x\right ) + 1\right ) - i \, {\rm Li}_2\left (-i \, \tan \left (x\right ) + 1\right ) \]

[In]

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

[Out]

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

Giac [F]

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.84 \[ \int \log \left (a \tan ^2(x)\right ) \, dx=x\,\ln \left (a\,{\mathrm {tan}\left (x\right )}^2\right )-\mathrm {polylog}\left (2,-{\mathrm {e}}^{x\,2{}\mathrm {i}}\right )\,1{}\mathrm {i}+4\,x\,\mathrm {atanh}\left ({\mathrm {e}}^{x\,2{}\mathrm {i}}\right )+\mathrm {polylog}\left (2,{\mathrm {e}}^{x\,2{}\mathrm {i}}\right )\,1{}\mathrm {i} \]

[In]

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

[Out]

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