Optimal. Leaf size=53 \[ \frac {(b c-a d)^2 \log (c+d \tanh (x))}{d^3}-\frac {b (b c-a d) \tanh (x)}{d^2}+\frac {(a+b \tanh (x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 53, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {4427, 45}
\begin {gather*} \frac {(b c-a d)^2 \log (c+d \tanh (x))}{d^3}-\frac {b \tanh (x) (b c-a d)}{d^2}+\frac {(a+b \tanh (x))^2}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 4427
Rubi steps
\begin {align*} \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx &=\text {Subst}\left (\int \frac {(a+b x)^2}{c+d x} \, dx,x,\tanh (x)\right )\\ &=\text {Subst}\left (\int \left (-\frac {b (b c-a d)}{d^2}+\frac {b (a+b x)}{d}+\frac {(-b c+a d)^2}{d^2 (c+d x)}\right ) \, dx,x,\tanh (x)\right )\\ &=\frac {(b c-a d)^2 \log (c+d \tanh (x))}{d^3}-\frac {b (b c-a d) \tanh (x)}{d^2}+\frac {(a+b \tanh (x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.43, size = 61, normalized size = 1.15 \begin {gather*} -\frac {2 (b c-a d)^2 (\log (\cosh (x))-\log (c \cosh (x)+d \sinh (x)))+b^2 d^2 \text {sech}^2(x)+2 b d (b c-2 a d) \tanh (x)}{2 d^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(148\) vs.
\(2(51)=102\).
time = 1.05, size = 149, normalized size = 2.81
method | result | size |
default | \(\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (c \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+2 d \tanh \left (\frac {x}{2}\right )+c \right )}{d^{3}}-\frac {2 \left (\frac {\left (-2 a \,d^{2} b +b^{2} c d \right ) \left (\tanh ^{3}\left (\frac {x}{2}\right )\right )-b^{2} d^{2} \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+\left (-2 a \,d^{2} b +b^{2} c d \right ) \tanh \left (\frac {x}{2}\right )}{\left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )^{2}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{2}\right )}{d^{3}}\) | \(149\) |
risch | \(-\frac {2 b \left (2 a d \,{\mathrm e}^{2 x}-b c \,{\mathrm e}^{2 x}+b d \,{\mathrm e}^{2 x}+2 a d -b c \right )}{\left (1+{\mathrm e}^{2 x}\right )^{2} d^{2}}-\frac {\ln \left (1+{\mathrm e}^{2 x}\right ) a^{2}}{d}+\frac {2 \ln \left (1+{\mathrm e}^{2 x}\right ) a b c}{d^{2}}-\frac {\ln \left (1+{\mathrm e}^{2 x}\right ) b^{2} c^{2}}{d^{3}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) a^{2}}{d}-\frac {2 \ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) a b c}{d^{2}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) b^{2} c^{2}}{d^{3}}\) | \(172\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 151 vs.
\(2 (51) = 102\).
time = 0.48, size = 151, normalized size = 2.85 \begin {gather*} -b^{2} {\left (\frac {2 \, {\left ({\left (c + d\right )} e^{\left (-2 \, x\right )} + c\right )}}{2 \, d^{2} e^{\left (-2 \, x\right )} + d^{2} e^{\left (-4 \, x\right )} + d^{2}} - \frac {c^{2} \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{3}} + \frac {c^{2} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{3}}\right )} - 2 \, a b {\left (\frac {c \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{2}} - \frac {c \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{2}} - \frac {2}{d e^{\left (-2 \, x\right )} + d}\right )} + \frac {a^{2} \log \left (d \tanh \left (x\right ) + c\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 688 vs.
\(2 (51) = 102\).
time = 0.48, size = 688, normalized size = 12.98 \begin {gather*} \frac {2 \, b^{2} c d - 4 \, a b d^{2} + 2 \, {\left (b^{2} c d - {\left (2 \, a b + b^{2}\right )} d^{2}\right )} \cosh \left (x\right )^{2} + 4 \, {\left (b^{2} c d - {\left (2 \, a b + b^{2}\right )} d^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) + 2 \, {\left (b^{2} c d - {\left (2 \, a b + b^{2}\right )} d^{2}\right )} \sinh \left (x\right )^{2} + {\left ({\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sinh \left (x\right )^{4} + b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} + 2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} + 3 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 4 \, {\left ({\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{3} + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, {\left (c \cosh \left (x\right ) + d \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) - {\left ({\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sinh \left (x\right )^{4} + b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} + 2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} + 3 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 4 \, {\left ({\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )^{3} + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{d^{3} \cosh \left (x\right )^{4} + 4 \, d^{3} \cosh \left (x\right ) \sinh \left (x\right )^{3} + d^{3} \sinh \left (x\right )^{4} + 2 \, d^{3} \cosh \left (x\right )^{2} + d^{3} + 2 \, {\left (3 \, d^{3} \cosh \left (x\right )^{2} + d^{3}\right )} \sinh \left (x\right )^{2} + 4 \, {\left (d^{3} \cosh \left (x\right )^{3} + d^{3} \cosh \left (x\right )\right )} \sinh \left (x\right )} \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 \frac {\left (a + b \tanh {\left (x \right )}\right )^{2} \operatorname {sech}^{2}{\left (x \right )}}{c + d \tanh {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 264 vs.
\(2 (51) = 102\).
time = 0.40, size = 264, normalized size = 4.98 \begin {gather*} \frac {{\left (b^{2} c^{3} - 2 \, a b c^{2} d + b^{2} c^{2} d + a^{2} c d^{2} - 2 \, a b c d^{2} + a^{2} d^{3}\right )} \log \left ({\left | c e^{\left (2 \, x\right )} + d e^{\left (2 \, x\right )} + c - d \right |}\right )}{c d^{3} + d^{4}} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{d^{3}} + \frac {3 \, b^{2} c^{2} e^{\left (4 \, x\right )} - 6 \, a b c d e^{\left (4 \, x\right )} + 3 \, a^{2} d^{2} e^{\left (4 \, x\right )} + 6 \, b^{2} c^{2} e^{\left (2 \, x\right )} - 12 \, a b c d e^{\left (2 \, x\right )} + 4 \, b^{2} c d e^{\left (2 \, x\right )} + 6 \, a^{2} d^{2} e^{\left (2 \, x\right )} - 8 \, a b d^{2} e^{\left (2 \, x\right )} - 4 \, b^{2} d^{2} e^{\left (2 \, x\right )} + 3 \, b^{2} c^{2} - 6 \, a b c d + 4 \, b^{2} c d + 3 \, a^{2} d^{2} - 8 \, a b d^{2}}{2 \, d^{3} {\left (e^{\left (2 \, x\right )} + 1\right )}^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.13, size = 107, normalized size = 2.02 \begin {gather*} \frac {\ln \left (c-d+d\,{\mathrm {e}}^{2\,x}+c\,{\mathrm {e}}^{2\,x}\right )\,{\left (a\,d-b\,c\right )}^2}{d^3}-\frac {2\,\left (b^2\,d-b^2\,c+2\,a\,b\,d\right )}{d^2\,\left ({\mathrm {e}}^{2\,x}+1\right )}-\frac {\ln \left ({\mathrm {e}}^{2\,x}+1\right )\,{\left (a\,d-b\,c\right )}^2}{d^3}+\frac {2\,b^2}{d\,\left (2\,{\mathrm {e}}^{2\,x}+{\mathrm {e}}^{4\,x}+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________