Integrand size = 19, antiderivative size = 31 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {(a+b) \log (\cosh (c+d x))}{d}-\frac {b \tanh ^2(c+d x)}{2 d} \] Output:
(a+b)*ln(cosh(d*x+c))/d-1/2*b*tanh(d*x+c)^2/d
Time = 0.05 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.26 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {a \log (\cosh (c+d x))}{d}+\frac {b \left (2 \log (\cosh (c+d x))+\text {sech}^2(c+d x)\right )}{2 d} \] Input:
Integrate[Tanh[c + d*x]*(a + b*Tanh[c + d*x]^2),x]
Output:
(a*Log[Cosh[c + d*x]])/d + (b*(2*Log[Cosh[c + d*x]] + Sech[c + d*x]^2))/(2 *d)
Result contains complex when optimal does not.
Time = 0.28 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.29, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.368, Rules used = {3042, 26, 4114, 26, 3042, 26, 3956}
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 \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -i \tan (i c+i d x) \left (a-b \tan (i c+i d x)^2\right )dx\) |
\(\Big \downarrow \) 26 |
\(\displaystyle -i \int \tan (i c+i d x) \left (a-b \tan (i c+i d x)^2\right )dx\) |
\(\Big \downarrow \) 4114 |
\(\displaystyle -i \left ((a+b) \int i \tanh (c+d x)dx-\frac {i b \tanh ^2(c+d x)}{2 d}\right )\) |
\(\Big \downarrow \) 26 |
\(\displaystyle -i \left (i (a+b) \int \tanh (c+d x)dx-\frac {i b \tanh ^2(c+d x)}{2 d}\right )\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -i \left (i (a+b) \int -i \tan (i c+i d x)dx-\frac {i b \tanh ^2(c+d x)}{2 d}\right )\) |
\(\Big \downarrow \) 26 |
\(\displaystyle -i \left ((a+b) \int \tan (i c+i d x)dx-\frac {i b \tanh ^2(c+d x)}{2 d}\right )\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -i \left (\frac {i (a+b) \log (\cosh (c+d x))}{d}-\frac {i b \tanh ^2(c+d x)}{2 d}\right )\) |
Input:
Int[Tanh[c + d*x]*(a + b*Tanh[c + d*x]^2),x]
Output:
(-I)*((I*(a + b)*Log[Cosh[c + d*x]])/d - ((I/2)*b*Tanh[c + d*x]^2)/d)
Int[(Complex[0, a_])*(Fx_), x_Symbol] :> Simp[(Complex[Identity[0], a]) I nt[Fx, x], x] /; FreeQ[a, x] && EqQ[a^2, 1]
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Simp[(A - C) Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a , b, e, f, A, C, m}, x] && NeQ[A*b^2 + a^2*C, 0] && !LeQ[m, -1]
Time = 0.36 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.58
method | result | size |
derivativedivides | \(\frac {-\frac {\tanh \left (d x +c \right )^{2} b}{2}-\frac {\left (a +b \right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (-a -b \right ) \ln \left (\tanh \left (d x +c \right )+1\right )}{2}}{d}\) | \(49\) |
default | \(\frac {-\frac {\tanh \left (d x +c \right )^{2} b}{2}-\frac {\left (a +b \right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (-a -b \right ) \ln \left (\tanh \left (d x +c \right )+1\right )}{2}}{d}\) | \(49\) |
parts | \(\frac {a \ln \left (\cosh \left (d x +c \right )\right )}{d}+\frac {b \left (-\frac {\tanh \left (d x +c \right )^{2}}{2}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right )}{2}-\frac {\ln \left (\tanh \left (d x +c \right )+1\right )}{2}\right )}{d}\) | \(52\) |
parallelrisch | \(-\frac {2 d x a +2 d x b +\tanh \left (d x +c \right )^{2} b +2 \ln \left (1-\tanh \left (d x +c \right )\right ) a +2 \ln \left (1-\tanh \left (d x +c \right )\right ) b}{2 d}\) | \(55\) |
risch | \(-a x -b x -\frac {2 a c}{d}-\frac {2 b c}{d}+\frac {2 b \,{\mathrm e}^{2 d x +2 c}}{d \left ({\mathrm e}^{2 d x +2 c}+1\right )^{2}}+\frac {\ln \left ({\mathrm e}^{2 d x +2 c}+1\right ) a}{d}+\frac {\ln \left ({\mathrm e}^{2 d x +2 c}+1\right ) b}{d}\) | \(86\) |
Input:
int(tanh(d*x+c)*(a+tanh(d*x+c)^2*b),x,method=_RETURNVERBOSE)
Output:
1/d*(-1/2*tanh(d*x+c)^2*b-1/2*(a+b)*ln(tanh(d*x+c)-1)+1/2*(-a-b)*ln(tanh(d *x+c)+1))
Leaf count of result is larger than twice the leaf count of optimal. 399 vs. \(2 (29) = 58\).
Time = 0.10 (sec) , antiderivative size = 399, normalized size of antiderivative = 12.87 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {{\left (a + b\right )} d x \cosh \left (d x + c\right )^{4} + 4 \, {\left (a + b\right )} d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a + b\right )} d x \sinh \left (d x + c\right )^{4} + {\left (a + b\right )} d x + 2 \, {\left ({\left (a + b\right )} d x - b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} d x \cosh \left (d x + c\right )^{2} + {\left (a + b\right )} d x - b\right )} \sinh \left (d x + c\right )^{2} - {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a + b\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a + b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} \cosh \left (d x + c\right )^{2} + a + b\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{3} + {\left (a + b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + a + b\right )} \log \left (\frac {2 \, \cosh \left (d x + c\right )}{\cosh \left (d x + c\right ) - \sinh \left (d x + c\right )}\right ) + 4 \, {\left ({\left (a + b\right )} d x \cosh \left (d x + c\right )^{3} + {\left ({\left (a + b\right )} d x - b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right )}{d \cosh \left (d x + c\right )^{4} + 4 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + d \sinh \left (d x + c\right )^{4} + 2 \, d \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, d \cosh \left (d x + c\right )^{2} + d\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left (d \cosh \left (d x + c\right )^{3} + d \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + d} \] Input:
integrate(tanh(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="fricas")
Output:
-((a + b)*d*x*cosh(d*x + c)^4 + 4*(a + b)*d*x*cosh(d*x + c)*sinh(d*x + c)^ 3 + (a + b)*d*x*sinh(d*x + c)^4 + (a + b)*d*x + 2*((a + b)*d*x - b)*cosh(d *x + c)^2 + 2*(3*(a + b)*d*x*cosh(d*x + c)^2 + (a + b)*d*x - b)*sinh(d*x + c)^2 - ((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a + b)*sinh(d*x + c)^4 + 2*(a + b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh (d*x + c)^2 + a + b)*sinh(d*x + c)^2 + 4*((a + b)*cosh(d*x + c)^3 + (a + b )*cosh(d*x + c))*sinh(d*x + c) + a + b)*log(2*cosh(d*x + c)/(cosh(d*x + c) - sinh(d*x + c))) + 4*((a + b)*d*x*cosh(d*x + c)^3 + ((a + b)*d*x - b)*co sh(d*x + c))*sinh(d*x + c))/(d*cosh(d*x + c)^4 + 4*d*cosh(d*x + c)*sinh(d* x + c)^3 + d*sinh(d*x + c)^4 + 2*d*cosh(d*x + c)^2 + 2*(3*d*cosh(d*x + c)^ 2 + d)*sinh(d*x + c)^2 + 4*(d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh(d*x + c) + d)
Leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (26) = 52\).
Time = 0.11 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.94 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\begin {cases} a x - \frac {a \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} + b x - \frac {b \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} - \frac {b \tanh ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tanh ^{2}{\left (c \right )}\right ) \tanh {\left (c \right )} & \text {otherwise} \end {cases} \] Input:
integrate(tanh(d*x+c)*(a+b*tanh(d*x+c)**2),x)
Output:
Piecewise((a*x - a*log(tanh(c + d*x) + 1)/d + b*x - b*log(tanh(c + d*x) + 1)/d - b*tanh(c + d*x)**2/(2*d), Ne(d, 0)), (x*(a + b*tanh(c)**2)*tanh(c), True))
Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (29) = 58\).
Time = 0.12 (sec) , antiderivative size = 76, normalized size of antiderivative = 2.45 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=b {\left (x + \frac {c}{d} + \frac {\log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{d} + \frac {2 \, e^{\left (-2 \, d x - 2 \, c\right )}}{d {\left (2 \, e^{\left (-2 \, d x - 2 \, c\right )} + e^{\left (-4 \, d x - 4 \, c\right )} + 1\right )}}\right )} + \frac {a \log \left (\cosh \left (d x + c\right )\right )}{d} \] Input:
integrate(tanh(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="maxima")
Output:
b*(x + c/d + log(e^(-2*d*x - 2*c) + 1)/d + 2*e^(-2*d*x - 2*c)/(d*(2*e^(-2* d*x - 2*c) + e^(-4*d*x - 4*c) + 1))) + a*log(cosh(d*x + c))/d
Time = 0.13 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.84 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {{\left (d x + c\right )} {\left (a + b\right )} - {\left (a + b\right )} \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) - \frac {2 \, b e^{\left (2 \, d x + 2 \, c\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{2}}}{d} \] Input:
integrate(tanh(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="giac")
Output:
-((d*x + c)*(a + b) - (a + b)*log(e^(2*d*x + 2*c) + 1) - 2*b*e^(2*d*x + 2* c)/(e^(2*d*x + 2*c) + 1)^2)/d
Time = 2.37 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.19 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=x\,\left (a+b\right )-\frac {b\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{2\,d}-\frac {\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )\,\left (a+b\right )}{d} \] Input:
int(tanh(c + d*x)*(a + b*tanh(c + d*x)^2),x)
Output:
x*(a + b) - (b*tanh(c + d*x)^2)/(2*d) - (log(tanh(c + d*x) + 1)*(a + b))/d
Time = 0.30 (sec) , antiderivative size = 249, normalized size of antiderivative = 8.03 \[ \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {e^{4 d x +4 c} \mathrm {log}\left (e^{2 d x +2 c}+1\right ) a +e^{4 d x +4 c} \mathrm {log}\left (e^{2 d x +2 c}+1\right ) b -e^{4 d x +4 c} a d x -e^{4 d x +4 c} b d x -e^{4 d x +4 c} b +2 e^{2 d x +2 c} \mathrm {log}\left (e^{2 d x +2 c}+1\right ) a +2 e^{2 d x +2 c} \mathrm {log}\left (e^{2 d x +2 c}+1\right ) b -2 e^{2 d x +2 c} a d x -2 e^{2 d x +2 c} b d x +\mathrm {log}\left (e^{2 d x +2 c}+1\right ) a +\mathrm {log}\left (e^{2 d x +2 c}+1\right ) b -a d x -b d x -b}{d \left (e^{4 d x +4 c}+2 e^{2 d x +2 c}+1\right )} \] Input:
int(tanh(d*x+c)*(a+b*tanh(d*x+c)^2),x)
Output:
(e**(4*c + 4*d*x)*log(e**(2*c + 2*d*x) + 1)*a + e**(4*c + 4*d*x)*log(e**(2 *c + 2*d*x) + 1)*b - e**(4*c + 4*d*x)*a*d*x - e**(4*c + 4*d*x)*b*d*x - e** (4*c + 4*d*x)*b + 2*e**(2*c + 2*d*x)*log(e**(2*c + 2*d*x) + 1)*a + 2*e**(2 *c + 2*d*x)*log(e**(2*c + 2*d*x) + 1)*b - 2*e**(2*c + 2*d*x)*a*d*x - 2*e** (2*c + 2*d*x)*b*d*x + log(e**(2*c + 2*d*x) + 1)*a + log(e**(2*c + 2*d*x) + 1)*b - a*d*x - b*d*x - b)/(d*(e**(4*c + 4*d*x) + 2*e**(2*c + 2*d*x) + 1))