Optimal. Leaf size=198 \[ x \cot ^{-1}(c+d \cot (a+b x))-\frac {1}{2} i x \log \left (1-\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )+\frac {1}{2} i x \log \left (1-\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )-\frac {\text {PolyLog}\left (2,\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )}{4 b}+\frac {\text {PolyLog}\left (2,\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )}{4 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 198, 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 = {5278, 2221,
2317, 2438} \begin {gather*} -\frac {\text {Li}_2\left (\frac {(i c-d+1) e^{2 i a+2 i b x}}{i c+d+1}\right )}{4 b}+\frac {\text {Li}_2\left (\frac {(c+i (d+1)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )}{4 b}-\frac {1}{2} i x \log \left (1-\frac {(i c-d+1) e^{2 i a+2 i b x}}{i c+d+1}\right )+\frac {1}{2} i x \log \left (1-\frac {(c+i (d+1)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )+x \cot ^{-1}(d \cot (a+b x)+c) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2317
Rule 2438
Rule 5278
Rubi steps
\begin {align*} \int \cot ^{-1}(c+d \cot (a+b x)) \, dx &=x \cot ^{-1}(c+d \cot (a+b x))-(b (1+i c-d)) \int \frac {e^{2 i a+2 i b x} x}{1+i c+d+(-1-i c+d) e^{2 i a+2 i b x}} \, dx+(b (1-i c+d)) \int \frac {e^{2 i a+2 i b x} x}{1-i c-d+(-1+i c-d) e^{2 i a+2 i b x}} \, dx\\ &=x \cot ^{-1}(c+d \cot (a+b x))-\frac {1}{2} i x \log \left (1-\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )+\frac {1}{2} i x \log \left (1-\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )-\frac {1}{2} i \int \log \left (1+\frac {(-1+i c-d) e^{2 i a+2 i b x}}{1-i c-d}\right ) \, dx+\frac {1}{2} i \int \log \left (1+\frac {(-1-i c+d) e^{2 i a+2 i b x}}{1+i c+d}\right ) \, dx\\ &=x \cot ^{-1}(c+d \cot (a+b x))-\frac {1}{2} i x \log \left (1-\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )+\frac {1}{2} i x \log \left (1-\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )-\frac {\text {Subst}\left (\int \frac {\log \left (1+\frac {(-1+i c-d) x}{1-i c-d}\right )}{x} \, dx,x,e^{2 i a+2 i b x}\right )}{4 b}+\frac {\text {Subst}\left (\int \frac {\log \left (1+\frac {(-1-i c+d) x}{1+i c+d}\right )}{x} \, dx,x,e^{2 i a+2 i b x}\right )}{4 b}\\ &=x \cot ^{-1}(c+d \cot (a+b x))-\frac {1}{2} i x \log \left (1-\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )+\frac {1}{2} i x \log \left (1-\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-d)}\right )-\frac {\text {Li}_2\left (\frac {(1+i c-d) e^{2 i a+2 i b x}}{1+i c+d}\right )}{4 b}+\frac {\text {Li}_2\left (\frac {(c+i (1+d)) e^{2 i a+2 i b x}}{c+i (1-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. \(1649\) vs. \(2(198)=396\).
time = 12.61, size = 1649, normalized size = 8.33 \begin {gather*} x \cot ^{-1}(c+d \cot (a+b x))-\frac {d \left (4 a \sqrt {-d^2} \text {ArcTan}\left (\frac {c d+\tan (a+b x)+c^2 \tan (a+b x)}{d}\right )+i d \log (1+i \tan (a+b x)) \log \left (\frac {c d-\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{i+i c^2+c d-\sqrt {-d^2}}\right )+i d \log (1-i \tan (a+b x)) \log \left (\frac {c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{-i-i c^2+c d+\sqrt {-d^2}}\right )-i d \log (1+i \tan (a+b x)) \log \left (\frac {c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{i+i c^2+c d+\sqrt {-d^2}}\right )-i d \log (1-i \tan (a+b x)) \log \left (\frac {-c d+\sqrt {-d^2}-\left (1+c^2\right ) \tan (a+b x)}{i+i c^2-c d+\sqrt {-d^2}}\right )-i d \text {PolyLog}\left (2,\frac {\left (1+c^2\right ) (1-i \tan (a+b x))}{1+c^2+i c d-i \sqrt {-d^2}}\right )+i d \text {PolyLog}\left (2,\frac {\left (1+c^2\right ) (1-i \tan (a+b x))}{1+c^2+i c d+i \sqrt {-d^2}}\right )-i d \text {PolyLog}\left (2,\frac {\left (1+c^2\right ) (1+i \tan (a+b x))}{1+c^2-i c d-i \sqrt {-d^2}}\right )+i d \text {PolyLog}\left (2,\frac {\left (1+c^2\right ) (1+i \tan (a+b x))}{1+c^2-i c d+i \sqrt {-d^2}}\right )\right ) \left (\frac {2 a}{b \left (-1-c^2-d^2+\cos (2 (a+b x))+c^2 \cos (2 (a+b x))-d^2 \cos (2 (a+b x))-2 c d \sin (2 (a+b x))\right )}-\frac {2 (a+b x)}{b \left (-1-c^2-d^2+\cos (2 (a+b x))+c^2 \cos (2 (a+b x))-d^2 \cos (2 (a+b x))-2 c d \sin (2 (a+b x))\right )}\right )}{\frac {d \log \left (1-\frac {\left (1+c^2\right ) (1-i \tan (a+b x))}{1+c^2+i c d-i \sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1-i \tan (a+b x)}-\frac {d \log \left (1-\frac {\left (1+c^2\right ) (1-i \tan (a+b x))}{1+c^2+i c d+i \sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1-i \tan (a+b x)}+\frac {d \log \left (\frac {c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{-i-i c^2+c d+\sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1-i \tan (a+b x)}-\frac {d \log \left (\frac {-c d+\sqrt {-d^2}-\left (1+c^2\right ) \tan (a+b x)}{i+i c^2-c d+\sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1-i \tan (a+b x)}-\frac {d \log \left (1-\frac {\left (1+c^2\right ) (1+i \tan (a+b x))}{1+c^2-i c d-i \sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1+i \tan (a+b x)}+\frac {d \log \left (1-\frac {\left (1+c^2\right ) (1+i \tan (a+b x))}{1+c^2-i c d+i \sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1+i \tan (a+b x)}-\frac {d \log \left (\frac {c d-\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{i+i c^2+c d-\sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1+i \tan (a+b x)}+\frac {d \log \left (\frac {c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}{i+i c^2+c d+\sqrt {-d^2}}\right ) \sec ^2(a+b x)}{1+i \tan (a+b x)}+\frac {i d \log (1+i \tan (a+b x)) \left (\sec ^2(a+b x)+c^2 \sec ^2(a+b x)\right )}{c d-\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}+\frac {i d \log (1-i \tan (a+b x)) \left (\sec ^2(a+b x)+c^2 \sec ^2(a+b x)\right )}{c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}-\frac {i d \log (1+i \tan (a+b x)) \left (\sec ^2(a+b x)+c^2 \sec ^2(a+b x)\right )}{c d+\sqrt {-d^2}+\tan (a+b x)+c^2 \tan (a+b x)}+\frac {i \left (1+c^2\right ) d \log (1-i \tan (a+b x)) \sec ^2(a+b x)}{-c d+\sqrt {-d^2}-\left (1+c^2\right ) \tan (a+b x)}+\frac {4 a \sqrt {-d^2} \left (\sec ^2(a+b x)+c^2 \sec ^2(a+b x)\right )}{d \left (1+\frac {\left (c d+\tan (a+b x)+c^2 \tan (a+b x)\right )^2}{d^2}\right )}} \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. 1145 vs. \(2 (168 ) = 336\).
time = 2.14, size = 1146, normalized size = 5.79
method | result | size |
derivativedivides | \(\text {Expression too large to display}\) | \(1146\) |
default | \(\text {Expression too large to display}\) | \(1146\) |
risch | \(\text {Expression too large to display}\) | \(4952\) |
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. 532 vs. \(2 (140) = 280\).
time = 0.55, size = 532, normalized size = 2.69 \begin {gather*} \frac {d {\left (\frac {8 \, {\left (b x + a\right )} \arctan \left (\frac {c d + {\left (c^{2} + 1\right )} \tan \left (b x + a\right )}{d}\right )}{d} - \frac {8 \, {\left (b x + a\right )} \arctan \left (\frac {c d + {\left (c^{2} + 1\right )} \tan \left (b x + a\right )}{d}\right ) - 4 \, \arctan \left (\frac {c d + {\left (c^{2} + 1\right )} \tan \left (b x + a\right )}{d}\right ) \arctan \left (\frac {c d + {\left (c^{2} + d + 1\right )} \tan \left (b x + a\right )}{c^{2} + d^{2} + 2 \, d + 1}, -\frac {c d \tan \left (b x + a\right ) - c^{2} - d - 1}{c^{2} + d^{2} + 2 \, d + 1}\right ) + 4 \, \arctan \left (\frac {c d + {\left (c^{2} + 1\right )} \tan \left (b x + a\right )}{d}\right ) \arctan \left (-\frac {c d + {\left (c^{2} - d + 1\right )} \tan \left (b x + a\right )}{c^{2} + d^{2} - 2 \, d + 1}, -\frac {c d \tan \left (b x + a\right ) - c^{2} + d - 1}{c^{2} + d^{2} - 2 \, d + 1}\right ) - {\left (\log \left (\frac {{\left (c^{2} + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + 1}{c^{2} + d^{2} + 2 \, d + 1}\right ) - \log \left (\frac {{\left (c^{2} + 1\right )} \tan \left (b x + a\right )^{2} + c^{2} + 1}{c^{2} + d^{2} - 2 \, d + 1}\right )\right )} \log \left ({\left (c^{2} + 1\right )} d^{2} + 2 \, {\left (c^{3} + c\right )} d \tan \left (b x + a\right ) + {\left (c^{4} + 2 \, c^{2} + 1\right )} \tan \left (b x + a\right )^{2}\right ) - 2 \, {\rm Li}_2\left (\frac {{\left (i \, c - 1\right )} \tan \left (b x + a\right ) + i \, d}{c + i \, d + i}\right ) + 2 \, {\rm Li}_2\left (\frac {{\left (i \, c + 1\right )} \tan \left (b x + a\right ) + i \, d}{c + i \, d - i}\right ) + 2 \, {\rm Li}_2\left (-\frac {{\left (i \, c - 1\right )} \tan \left (b x + a\right ) + i \, d}{c - i \, d + i}\right ) - 2 \, {\rm Li}_2\left (-\frac {{\left (i \, c + 1\right )} \tan \left (b x + a\right ) + i \, d}{c - i \, d - i}\right )}{d}\right )} + 8 \, {\left (b x + a\right )} \operatorname {arccot}\left (c + \frac {d}{\tan \left (b x + a\right )}\right ) - 8 \, {\left (b x + a\right )} \arctan \left (\frac {c d + {\left (c^{2} + 1\right )} \tan \left (b x + a\right )}{d}\right )}{8 \, 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. 965 vs. \(2 (140) = 280\).
time = 4.54, size = 965, normalized size = 4.87 \begin {gather*} \frac {8 \, b x \operatorname {arccot}\left (d \cot \left (b x + a\right ) + c\right ) + 2 i \, a \log \left (\frac {1}{2} \, c^{2} + i \, c d - \frac {1}{2} \, d^{2} - \frac {1}{2} \, {\left (c^{2} + d^{2} + 2 \, d + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + \frac {1}{2} \, {\left (i \, c^{2} + i \, d^{2} + 2 i \, d + i\right )} \sin \left (2 \, b x + 2 \, a\right ) + \frac {1}{2}\right ) - 2 i \, a \log \left (\frac {1}{2} \, c^{2} + i \, c d - \frac {1}{2} \, d^{2} - \frac {1}{2} \, {\left (c^{2} + d^{2} - 2 \, d + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + \frac {1}{2} \, {\left (i \, c^{2} + i \, d^{2} - 2 i \, d + i\right )} \sin \left (2 \, b x + 2 \, a\right ) + \frac {1}{2}\right ) - 2 i \, a \log \left (-\frac {1}{2} \, c^{2} + i \, c d + \frac {1}{2} \, d^{2} + \frac {1}{2} \, {\left (c^{2} + d^{2} + 2 \, d + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + \frac {1}{2} \, {\left (i \, c^{2} + i \, d^{2} + 2 i \, d + i\right )} \sin \left (2 \, b x + 2 \, a\right ) - \frac {1}{2}\right ) + 2 i \, a \log \left (-\frac {1}{2} \, c^{2} + i \, c d + \frac {1}{2} \, d^{2} + \frac {1}{2} \, {\left (c^{2} + d^{2} - 2 \, d + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + \frac {1}{2} \, {\left (i \, c^{2} + i \, d^{2} - 2 i \, d + i\right )} \sin \left (2 \, b x + 2 \, a\right ) - \frac {1}{2}\right ) - 2 \, {\left (i \, b x + i \, a\right )} \log \left (\frac {c^{2} + d^{2} - {\left (c^{2} + 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (-i \, c^{2} + 2 \, c d + i \, d^{2} - i\right )} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, d + 1}{c^{2} + d^{2} + 2 \, d + 1}\right ) - 2 \, {\left (-i \, b x - i \, a\right )} \log \left (\frac {c^{2} + d^{2} - {\left (c^{2} - 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (i \, c^{2} + 2 \, c d - i \, d^{2} + i\right )} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, d + 1}{c^{2} + d^{2} + 2 \, d + 1}\right ) - 2 \, {\left (-i \, b x - i \, a\right )} \log \left (\frac {c^{2} + d^{2} - {\left (c^{2} + 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (-i \, c^{2} + 2 \, c d + i \, d^{2} - i\right )} \sin \left (2 \, b x + 2 \, a\right ) - 2 \, d + 1}{c^{2} + d^{2} - 2 \, d + 1}\right ) - 2 \, {\left (i \, b x + i \, a\right )} \log \left (\frac {c^{2} + d^{2} - {\left (c^{2} - 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (i \, c^{2} + 2 \, c d - i \, d^{2} + i\right )} \sin \left (2 \, b x + 2 \, a\right ) - 2 \, d + 1}{c^{2} + d^{2} - 2 \, d + 1}\right ) - {\rm Li}_2\left (-\frac {c^{2} + d^{2} - {\left (c^{2} + 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (-i \, c^{2} + 2 \, c d + i \, d^{2} - i\right )} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, d + 1}{c^{2} + d^{2} + 2 \, d + 1} + 1\right ) - {\rm Li}_2\left (-\frac {c^{2} + d^{2} - {\left (c^{2} - 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (i \, c^{2} + 2 \, c d - i \, d^{2} + i\right )} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, d + 1}{c^{2} + d^{2} + 2 \, d + 1} + 1\right ) + {\rm Li}_2\left (-\frac {c^{2} + d^{2} - {\left (c^{2} + 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (-i \, c^{2} + 2 \, c d + i \, d^{2} - i\right )} \sin \left (2 \, b x + 2 \, a\right ) - 2 \, d + 1}{c^{2} + d^{2} - 2 \, d + 1} + 1\right ) + {\rm Li}_2\left (-\frac {c^{2} + d^{2} - {\left (c^{2} - 2 i \, c d - d^{2} + 1\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (i \, c^{2} + 2 \, c d - i \, d^{2} + i\right )} \sin \left (2 \, b x + 2 \, a\right ) - 2 \, d + 1}{c^{2} + d^{2} - 2 \, d + 1} + 1\right )}{8 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \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 {acot}\left (c+d\,\mathrm {cot}\left (a+b\,x\right )\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________