Optimal. Leaf size=194 \[ x \tanh ^{-1}(c+d \tan (a+b x))+\frac {1}{2} x \log \left (1+\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )-\frac {1}{2} x \log \left (1+\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )-\frac {i \text {PolyLog}\left (2,-\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )}{4 b}+\frac {i \text {PolyLog}\left (2,-\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )}{4 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 194, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 4, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {6394, 2221,
2317, 2438} \begin {gather*} -\frac {i \text {Li}_2\left (-\frac {(-c+i d+1) e^{2 i a+2 i b x}}{-c-i d+1}\right )}{4 b}+\frac {i \text {Li}_2\left (-\frac {(c-i d+1) e^{2 i a+2 i b x}}{c+i d+1}\right )}{4 b}+\frac {1}{2} x \log \left (1+\frac {(-c+i d+1) e^{2 i a+2 i b x}}{-c-i d+1}\right )-\frac {1}{2} x \log \left (1+\frac {(c-i d+1) e^{2 i a+2 i b x}}{c+i d+1}\right )+x \tanh ^{-1}(d \tan (a+b x)+c) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2317
Rule 2438
Rule 6394
Rubi steps
\begin {align*} \int \tanh ^{-1}(c+d \tan (a+b x)) \, dx &=x \tanh ^{-1}(c+d \tan (a+b x))+(b (i (1-c)-d)) \int \frac {e^{2 i a+2 i b x} x}{1-c-i d+(1-c+i d) e^{2 i a+2 i b x}} \, dx-(b (i+i c+d)) \int \frac {e^{2 i a+2 i b x} x}{1+c+i d+(1+c-i d) e^{2 i a+2 i b x}} \, dx\\ &=x \tanh ^{-1}(c+d \tan (a+b x))+\frac {1}{2} x \log \left (1+\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )-\frac {1}{2} x \log \left (1+\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )-\frac {1}{2} \int \log \left (1+\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right ) \, dx+\frac {1}{2} \int \log \left (1+\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right ) \, dx\\ &=x \tanh ^{-1}(c+d \tan (a+b x))+\frac {1}{2} x \log \left (1+\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )-\frac {1}{2} x \log \left (1+\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )+\frac {i \text {Subst}\left (\int \frac {\log \left (1+\frac {(1-c+i d) x}{1-c-i d}\right )}{x} \, dx,x,e^{2 i a+2 i b x}\right )}{4 b}-\frac {i \text {Subst}\left (\int \frac {\log \left (1+\frac {(1+c-i d) x}{1+c+i d}\right )}{x} \, dx,x,e^{2 i a+2 i b x}\right )}{4 b}\\ &=x \tanh ^{-1}(c+d \tan (a+b x))+\frac {1}{2} x \log \left (1+\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )-\frac {1}{2} x \log \left (1+\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )-\frac {i \text {Li}_2\left (-\frac {(1-c+i d) e^{2 i a+2 i b x}}{1-c-i d}\right )}{4 b}+\frac {i \text {Li}_2\left (-\frac {(1+c-i d) e^{2 i a+2 i b x}}{1+c+i d}\right )}{4 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(4654\) vs. \(2(194)=388\).
time = 30.41, size = 4654, normalized size = 23.99 \begin {gather*} \text {Result too large to show} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 562 vs. \(2 (164 ) = 328\).
time = 1.28, size = 563, normalized size = 2.90
method | result | size |
derivativedivides | \(\frac {d \arctan \left (\tan \left (b x +a \right )\right ) \arctanh \left (c +d \tan \left (b x +a \right )\right )-d^{2} \left (-\frac {\arctan \left (-\frac {c +d \tan \left (b x +a \right )}{d}+\frac {c}{d}\right ) \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c +1\right )}{2 d}+\frac {\arctan \left (-\frac {c +d \tan \left (b x +a \right )}{d}+\frac {c}{d}\right ) \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c -1\right )}{2 d}+\frac {i \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c +1\right ) \left (\ln \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c +1}\right )-\ln \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c -1}\right )\right )}{4 d}+\frac {i \dilog \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c +1}\right )}{4 d}-\frac {i \dilog \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c -1}\right )}{4 d}-\frac {i \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c -1\right ) \left (\ln \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c -1}\right )-\ln \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c +1}\right )\right )}{4 d}-\frac {i \dilog \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c -1}\right )}{4 d}+\frac {i \dilog \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c +1}\right )}{4 d}\right )}{b d}\) | \(563\) |
default | \(\frac {d \arctan \left (\tan \left (b x +a \right )\right ) \arctanh \left (c +d \tan \left (b x +a \right )\right )-d^{2} \left (-\frac {\arctan \left (-\frac {c +d \tan \left (b x +a \right )}{d}+\frac {c}{d}\right ) \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c +1\right )}{2 d}+\frac {\arctan \left (-\frac {c +d \tan \left (b x +a \right )}{d}+\frac {c}{d}\right ) \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c -1\right )}{2 d}+\frac {i \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c +1\right ) \left (\ln \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c +1}\right )-\ln \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c -1}\right )\right )}{4 d}+\frac {i \dilog \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c +1}\right )}{4 d}-\frac {i \dilog \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c -1}\right )}{4 d}-\frac {i \ln \left (d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )+c -1\right ) \left (\ln \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c -1}\right )-\ln \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c +1}\right )\right )}{4 d}-\frac {i \dilog \left (\frac {i d -d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d +c -1}\right )}{4 d}+\frac {i \dilog \left (\frac {i d +d \left (\frac {c +d \tan \left (b x +a \right )}{d}-\frac {c}{d}\right )}{i d -c +1}\right )}{4 d}\right )}{b d}\) | \(563\) |
risch | \(\text {Expression too large to display}\) | \(3967\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 372 vs. \(2 (136) = 272\).
time = 0.54, size = 372, normalized size = 1.92 \begin {gather*} \frac {4 \, {\left (b x + a\right )} \operatorname {artanh}\left (d \tan \left (b x + a\right ) + c\right ) + {\left (\arctan \left (\frac {d^{2} \tan \left (b x + a\right ) + {\left (c + 1\right )} d}{c^{2} + d^{2} + 2 \, c + 1}, \frac {{\left (c + 1\right )} d \tan \left (b x + a\right ) + c^{2} + 2 \, c + 1}{c^{2} + d^{2} + 2 \, c + 1}\right ) - \arctan \left (\frac {d^{2} \tan \left (b x + a\right ) + {\left (c - 1\right )} d}{c^{2} + d^{2} - 2 \, c + 1}, \frac {{\left (c - 1\right )} d \tan \left (b x + a\right ) + c^{2} - 2 \, c + 1}{c^{2} + d^{2} - 2 \, c + 1}\right )\right )} \log \left (\tan \left (b x + a\right )^{2} + 1\right ) - {\left (b x + a\right )} \log \left (\frac {d^{2} \tan \left (b x + a\right )^{2} + 2 \, {\left (c + 1\right )} d \tan \left (b x + a\right ) + c^{2} + 2 \, c + 1}{c^{2} + d^{2} + 2 \, c + 1}\right ) + {\left (b x + a\right )} \log \left (\frac {d^{2} \tan \left (b x + a\right )^{2} + 2 \, {\left (c - 1\right )} d \tan \left (b x + a\right ) + c^{2} - 2 \, c + 1}{c^{2} + d^{2} - 2 \, c + 1}\right ) - i \, {\rm Li}_2\left (-\frac {i \, d \tan \left (b x + a\right ) - d}{i \, c + d + i}\right ) + i \, {\rm Li}_2\left (-\frac {i \, d \tan \left (b x + a\right ) - d}{i \, c + d - i}\right ) - i \, {\rm Li}_2\left (\frac {i \, d \tan \left (b x + a\right ) + d}{-i \, c + d + i}\right ) + i \, {\rm Li}_2\left (\frac {i \, d \tan \left (b x + a\right ) + d}{-i \, c + d - i}\right )}{4 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 1185 vs. \(2 (136) = 272\).
time = 0.53, size = 1185, normalized size = 6.11 \begin {gather*} \frac {4 \, b x \log \left (-\frac {d \tan \left (b x + a\right ) + c + 1}{d \tan \left (b x + a\right ) + c - 1}\right ) - 2 \, {\left (b x + a\right )} \log \left (-\frac {2 \, {\left ({\left (i \, {\left (c + 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} - i \, {\left (c + 1\right )} d + {\left (i \, c^{2} - 2 \, {\left (c + 1\right )} d - i \, d^{2} + 2 i \, c + i\right )} \tan \left (b x + a\right ) - 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} + 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} + 2 \, c + 1}\right ) - 2 \, {\left (b x + a\right )} \log \left (-\frac {2 \, {\left ({\left (-i \, {\left (c + 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c + 1\right )} d + {\left (-i \, c^{2} - 2 \, {\left (c + 1\right )} d + i \, d^{2} - 2 i \, c - i\right )} \tan \left (b x + a\right ) - 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} + 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} + 2 \, c + 1}\right ) + 2 \, {\left (b x + a\right )} \log \left (-\frac {2 \, {\left ({\left (i \, {\left (c - 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} - i \, {\left (c - 1\right )} d + {\left (i \, c^{2} - 2 \, {\left (c - 1\right )} d - i \, d^{2} - 2 i \, c + i\right )} \tan \left (b x + a\right ) + 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} - 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} - 2 \, c + 1}\right ) + 2 \, {\left (b x + a\right )} \log \left (-\frac {2 \, {\left ({\left (-i \, {\left (c - 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c - 1\right )} d + {\left (-i \, c^{2} - 2 \, {\left (c - 1\right )} d + i \, d^{2} + 2 i \, c - i\right )} \tan \left (b x + a\right ) + 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} - 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} - 2 \, c + 1}\right ) + 2 \, a \log \left (\frac {{\left (i \, {\left (c + 1\right )} d + d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c + 1\right )} d + {\left (i \, c^{2} + i \, d^{2} + 2 i \, c + i\right )} \tan \left (b x + a\right ) - 2 \, c - 1}{\tan \left (b x + a\right )^{2} + 1}\right ) + 2 \, a \log \left (\frac {{\left (i \, {\left (c + 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} + c^{2} + i \, {\left (c + 1\right )} d + {\left (i \, c^{2} + i \, d^{2} + 2 i \, c + i\right )} \tan \left (b x + a\right ) + 2 \, c + 1}{\tan \left (b x + a\right )^{2} + 1}\right ) - 2 \, a \log \left (\frac {{\left (i \, {\left (c - 1\right )} d + d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c - 1\right )} d + {\left (i \, c^{2} + i \, d^{2} - 2 i \, c + i\right )} \tan \left (b x + a\right ) + 2 \, c - 1}{\tan \left (b x + a\right )^{2} + 1}\right ) - 2 \, a \log \left (\frac {{\left (i \, {\left (c - 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} + c^{2} + i \, {\left (c - 1\right )} d + {\left (i \, c^{2} + i \, d^{2} - 2 i \, c + i\right )} \tan \left (b x + a\right ) - 2 \, c + 1}{\tan \left (b x + a\right )^{2} + 1}\right ) - i \, {\rm Li}_2\left (\frac {2 \, {\left ({\left (i \, {\left (c + 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} - i \, {\left (c + 1\right )} d + {\left (i \, c^{2} - 2 \, {\left (c + 1\right )} d - i \, d^{2} + 2 i \, c + i\right )} \tan \left (b x + a\right ) - 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} + 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} + 2 \, c + 1} + 1\right ) + i \, {\rm Li}_2\left (\frac {2 \, {\left ({\left (-i \, {\left (c + 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c + 1\right )} d + {\left (-i \, c^{2} - 2 \, {\left (c + 1\right )} d + i \, d^{2} - 2 i \, c - i\right )} \tan \left (b x + a\right ) - 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} + 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} + 2 \, c + 1} + 1\right ) + i \, {\rm Li}_2\left (\frac {2 \, {\left ({\left (i \, {\left (c - 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} - i \, {\left (c - 1\right )} d + {\left (i \, c^{2} - 2 \, {\left (c - 1\right )} d - i \, d^{2} - 2 i \, c + i\right )} \tan \left (b x + a\right ) + 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} - 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} - 2 \, c + 1} + 1\right ) - i \, {\rm Li}_2\left (\frac {2 \, {\left ({\left (-i \, {\left (c - 1\right )} d - d^{2}\right )} \tan \left (b x + a\right )^{2} - c^{2} + i \, {\left (c - 1\right )} d + {\left (-i \, c^{2} - 2 \, {\left (c - 1\right )} d + i \, d^{2} + 2 i \, c - i\right )} \tan \left (b x + a\right ) + 2 \, c - 1\right )}}{{\left (c^{2} + d^{2} - 2 \, c + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + d^{2} - 2 \, c + 1} + 1\right )}{8 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \operatorname {atanh}{\left (c + d \tan {\left (a + b x \right )} \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \mathrm {atanh}\left (c+d\,\mathrm {tan}\left (a+b\,x\right )\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________