3.58 \(\int (a+b \tanh (c+d x))^4 \, dx\)

Optimal. Leaf size=101 \[ -\frac {b^2 \left (3 a^2+b^2\right ) \tanh (c+d x)}{d}+\frac {4 a b \left (a^2+b^2\right ) \log (\cosh (c+d x))}{d}+x \left (a^4+6 a^2 b^2+b^4\right )-\frac {b (a+b \tanh (c+d x))^3}{3 d}-\frac {a b (a+b \tanh (c+d x))^2}{d} \]

[Out]

(a^4+6*a^2*b^2+b^4)*x+4*a*b*(a^2+b^2)*ln(cosh(d*x+c))/d-b^2*(3*a^2+b^2)*tanh(d*x+c)/d-a*b*(a+b*tanh(d*x+c))^2/
d-1/3*b*(a+b*tanh(d*x+c))^3/d

________________________________________________________________________________________

Rubi [A]  time = 0.12, antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3482, 3528, 3525, 3475} \[ -\frac {b^2 \left (3 a^2+b^2\right ) \tanh (c+d x)}{d}+\frac {4 a b \left (a^2+b^2\right ) \log (\cosh (c+d x))}{d}+x \left (6 a^2 b^2+a^4+b^4\right )-\frac {b (a+b \tanh (c+d x))^3}{3 d}-\frac {a b (a+b \tanh (c+d x))^2}{d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tanh[c + d*x])^4,x]

[Out]

(a^4 + 6*a^2*b^2 + b^4)*x + (4*a*b*(a^2 + b^2)*Log[Cosh[c + d*x]])/d - (b^2*(3*a^2 + b^2)*Tanh[c + d*x])/d - (
a*b*(a + b*Tanh[c + d*x])^2)/d - (b*(a + b*Tanh[c + d*x])^3)/(3*d)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3482

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(a + b*Tan[c + d*x])^(n - 1))/(d*(n - 1)
), x] + Int[(a^2 - b^2 + 2*a*b*Tan[c + d*x])*(a + b*Tan[c + d*x])^(n - 2), x] /; FreeQ[{a, b, c, d}, x] && NeQ
[a^2 + b^2, 0] && GtQ[n, 1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rubi steps

\begin {align*} \int (a+b \tanh (c+d x))^4 \, dx &=-\frac {b (a+b \tanh (c+d x))^3}{3 d}+\int (a+b \tanh (c+d x))^2 \left (a^2+b^2+2 a b \tanh (c+d x)\right ) \, dx\\ &=-\frac {a b (a+b \tanh (c+d x))^2}{d}-\frac {b (a+b \tanh (c+d x))^3}{3 d}+\int (a+b \tanh (c+d x)) \left (a \left (a^2+3 b^2\right )+b \left (3 a^2+b^2\right ) \tanh (c+d x)\right ) \, dx\\ &=\left (a^4+6 a^2 b^2+b^4\right ) x-\frac {b^2 \left (3 a^2+b^2\right ) \tanh (c+d x)}{d}-\frac {a b (a+b \tanh (c+d x))^2}{d}-\frac {b (a+b \tanh (c+d x))^3}{3 d}+\left (4 a b \left (a^2+b^2\right )\right ) \int \tanh (c+d x) \, dx\\ &=\left (a^4+6 a^2 b^2+b^4\right ) x+\frac {4 a b \left (a^2+b^2\right ) \log (\cosh (c+d x))}{d}-\frac {b^2 \left (3 a^2+b^2\right ) \tanh (c+d x)}{d}-\frac {a b (a+b \tanh (c+d x))^2}{d}-\frac {b (a+b \tanh (c+d x))^3}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.36, size = 91, normalized size = 0.90 \[ -\frac {6 b^2 \left (6 a^2+b^2\right ) \tanh (c+d x)+12 a b^3 \tanh ^2(c+d x)-3 (a-b)^4 \log (\tanh (c+d x)+1)+3 (a+b)^4 \log (1-\tanh (c+d x))+2 b^4 \tanh ^3(c+d x)}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tanh[c + d*x])^4,x]

[Out]

-1/6*(3*(a + b)^4*Log[1 - Tanh[c + d*x]] - 3*(a - b)^4*Log[1 + Tanh[c + d*x]] + 6*b^2*(6*a^2 + b^2)*Tanh[c + d
*x] + 12*a*b^3*Tanh[c + d*x]^2 + 2*b^4*Tanh[c + d*x]^3)/d

________________________________________________________________________________________

fricas [B]  time = 0.83, size = 1389, normalized size = 13.75 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^4,x, algorithm="fricas")

[Out]

1/3*(3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x*cosh(d*x + c)^6 + 18*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b
^3 + b^4)*d*x*cosh(d*x + c)*sinh(d*x + c)^5 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x*sinh(d*x + c)^
6 + 3*(12*a^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x)*cosh(d*x + c)^4 + 3*(
15*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x*cosh(d*x + c)^2 + 12*a^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4
*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x)*sinh(d*x + c)^4 + 36*a^2*b^2 + 8*b^4 + 12*(5*(a^4 - 4*a^3*b + 6*a^2*b
^2 - 4*a*b^3 + b^4)*d*x*cosh(d*x + c)^3 + (12*a^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b
^3 + b^4)*d*x)*cosh(d*x + c))*sinh(d*x + c)^3 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x + 3*(24*a^2*
b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x)*cosh(d*x + c)^2 + 3*(15*(a^4 - 4*a^
3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x*cosh(d*x + c)^4 + 24*a^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2
*b^2 - 4*a*b^3 + b^4)*d*x + 6*(12*a^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*
x)*cosh(d*x + c)^2)*sinh(d*x + c)^2 + 12*((a^3*b + a*b^3)*cosh(d*x + c)^6 + 6*(a^3*b + a*b^3)*cosh(d*x + c)*si
nh(d*x + c)^5 + (a^3*b + a*b^3)*sinh(d*x + c)^6 + 3*(a^3*b + a*b^3)*cosh(d*x + c)^4 + 3*(a^3*b + a*b^3 + 5*(a^
3*b + a*b^3)*cosh(d*x + c)^2)*sinh(d*x + c)^4 + a^3*b + a*b^3 + 4*(5*(a^3*b + a*b^3)*cosh(d*x + c)^3 + 3*(a^3*
b + a*b^3)*cosh(d*x + c))*sinh(d*x + c)^3 + 3*(a^3*b + a*b^3)*cosh(d*x + c)^2 + 3*(5*(a^3*b + a*b^3)*cosh(d*x
+ c)^4 + a^3*b + a*b^3 + 6*(a^3*b + a*b^3)*cosh(d*x + c)^2)*sinh(d*x + c)^2 + 6*((a^3*b + a*b^3)*cosh(d*x + c)
^5 + 2*(a^3*b + a*b^3)*cosh(d*x + c)^3 + (a^3*b + a*b^3)*cosh(d*x + c))*sinh(d*x + c))*log(2*cosh(d*x + c)/(co
sh(d*x + c) - sinh(d*x + c))) + 6*(3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x*cosh(d*x + c)^5 + 2*(12*a
^2*b^2 + 8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x)*cosh(d*x + c)^3 + (24*a^2*b^2 +
8*a*b^3 + 4*b^4 + 3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*d*x)*cosh(d*x + c))*sinh(d*x + c))/(d*cosh(d*x
 + c)^6 + 6*d*cosh(d*x + c)*sinh(d*x + c)^5 + d*sinh(d*x + c)^6 + 3*d*cosh(d*x + c)^4 + 3*(5*d*cosh(d*x + c)^2
 + d)*sinh(d*x + c)^4 + 4*(5*d*cosh(d*x + c)^3 + 3*d*cosh(d*x + c))*sinh(d*x + c)^3 + 3*d*cosh(d*x + c)^2 + 3*
(5*d*cosh(d*x + c)^4 + 6*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^2 + 6*(d*cosh(d*x + c)^5 + 2*d*cosh(d*x + c)^3 +
 d*cosh(d*x + c))*sinh(d*x + c) + d)

________________________________________________________________________________________

giac [A]  time = 0.16, size = 152, normalized size = 1.50 \[ \frac {3 \, {\left (a^{4} - 4 \, a^{3} b + 6 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} {\left (d x + c\right )} + 12 \, {\left (a^{3} b + a b^{3}\right )} \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) + \frac {4 \, {\left (9 \, a^{2} b^{2} + 2 \, b^{4} + 3 \, {\left (3 \, a^{2} b^{2} + 2 \, a b^{3} + b^{4}\right )} e^{\left (4 \, d x + 4 \, c\right )} + 3 \, {\left (6 \, a^{2} b^{2} + 2 \, a b^{3} + b^{4}\right )} e^{\left (2 \, d x + 2 \, c\right )}\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{3}}}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^4,x, algorithm="giac")

[Out]

1/3*(3*(a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*(d*x + c) + 12*(a^3*b + a*b^3)*log(e^(2*d*x + 2*c) + 1) + 4
*(9*a^2*b^2 + 2*b^4 + 3*(3*a^2*b^2 + 2*a*b^3 + b^4)*e^(4*d*x + 4*c) + 3*(6*a^2*b^2 + 2*a*b^3 + b^4)*e^(2*d*x +
 2*c))/(e^(2*d*x + 2*c) + 1)^3)/d

________________________________________________________________________________________

maple [B]  time = 0.01, size = 246, normalized size = 2.44 \[ -\frac {b^{4} \left (\tanh ^{3}\left (d x +c \right )\right )}{3 d}-\frac {2 \left (\tanh ^{2}\left (d x +c \right )\right ) a \,b^{3}}{d}-\frac {6 \tanh \left (d x +c \right ) a^{2} b^{2}}{d}-\frac {\tanh \left (d x +c \right ) b^{4}}{d}-\frac {a^{4} \ln \left (\tanh \left (d x +c \right )-1\right )}{2 d}-\frac {2 \ln \left (\tanh \left (d x +c \right )-1\right ) a^{3} b}{d}-\frac {3 \ln \left (\tanh \left (d x +c \right )-1\right ) a^{2} b^{2}}{d}-\frac {2 \ln \left (\tanh \left (d x +c \right )-1\right ) a \,b^{3}}{d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) b^{4}}{2 d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) a^{4}}{2 d}-\frac {2 \ln \left (1+\tanh \left (d x +c \right )\right ) a^{3} b}{d}+\frac {3 \ln \left (1+\tanh \left (d x +c \right )\right ) a^{2} b^{2}}{d}-\frac {2 \ln \left (1+\tanh \left (d x +c \right )\right ) a \,b^{3}}{d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) b^{4}}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tanh(d*x+c))^4,x)

[Out]

-1/3/d*b^4*tanh(d*x+c)^3-2/d*tanh(d*x+c)^2*a*b^3-6/d*tanh(d*x+c)*a^2*b^2-1/d*tanh(d*x+c)*b^4-1/2/d*a^4*ln(tanh
(d*x+c)-1)-2/d*ln(tanh(d*x+c)-1)*a^3*b-3/d*ln(tanh(d*x+c)-1)*a^2*b^2-2/d*ln(tanh(d*x+c)-1)*a*b^3-1/2/d*ln(tanh
(d*x+c)-1)*b^4+1/2/d*ln(1+tanh(d*x+c))*a^4-2/d*ln(1+tanh(d*x+c))*a^3*b+3/d*ln(1+tanh(d*x+c))*a^2*b^2-2/d*ln(1+
tanh(d*x+c))*a*b^3+1/2/d*ln(1+tanh(d*x+c))*b^4

________________________________________________________________________________________

maxima [B]  time = 0.42, size = 201, normalized size = 1.99 \[ \frac {1}{3} \, b^{4} {\left (3 \, x + \frac {3 \, c}{d} - \frac {4 \, {\left (3 \, e^{\left (-2 \, d x - 2 \, c\right )} + 3 \, e^{\left (-4 \, d x - 4 \, c\right )} + 2\right )}}{d {\left (3 \, e^{\left (-2 \, d x - 2 \, c\right )} + 3 \, e^{\left (-4 \, d x - 4 \, c\right )} + e^{\left (-6 \, d x - 6 \, c\right )} + 1\right )}}\right )} + 4 \, a b^{3} {\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 )} + 6 \, a^{2} b^{2} {\left (x + \frac {c}{d} - \frac {2}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a^{4} x + \frac {4 \, a^{3} b \log \left (\cosh \left (d x + c\right )\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^4,x, algorithm="maxima")

[Out]

1/3*b^4*(3*x + 3*c/d - 4*(3*e^(-2*d*x - 2*c) + 3*e^(-4*d*x - 4*c) + 2)/(d*(3*e^(-2*d*x - 2*c) + 3*e^(-4*d*x -
4*c) + e^(-6*d*x - 6*c) + 1))) + 4*a*b^3*(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))) + 6*a^2*b^2*(x + c/d - 2/(d*(e^(-2*d*x - 2*c) + 1))) + a^4*x + 4*a^3*b
*log(cosh(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 1.09, size = 113, normalized size = 1.12 \[ x\,\left (a^4+4\,a^3\,b+6\,a^2\,b^2+4\,a\,b^3+b^4\right )-\frac {b^4\,{\mathrm {tanh}\left (c+d\,x\right )}^3}{3\,d}-\frac {\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )\,\left (4\,a^3\,b+4\,a\,b^3\right )}{d}-\frac {2\,a\,b^3\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{d}-\frac {b^2\,\mathrm {tanh}\left (c+d\,x\right )\,\left (6\,a^2+b^2\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tanh(c + d*x))^4,x)

[Out]

x*(4*a*b^3 + 4*a^3*b + a^4 + b^4 + 6*a^2*b^2) - (b^4*tanh(c + d*x)^3)/(3*d) - (log(tanh(c + d*x) + 1)*(4*a*b^3
 + 4*a^3*b))/d - (2*a*b^3*tanh(c + d*x)^2)/d - (b^2*tanh(c + d*x)*(6*a^2 + b^2))/d

________________________________________________________________________________________

sympy [A]  time = 0.42, size = 144, normalized size = 1.43 \[ \begin {cases} a^{4} x + 4 a^{3} b x - \frac {4 a^{3} b \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} + 6 a^{2} b^{2} x - \frac {6 a^{2} b^{2} \tanh {\left (c + d x \right )}}{d} + 4 a b^{3} x - \frac {4 a b^{3} \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} - \frac {2 a b^{3} \tanh ^{2}{\left (c + d x \right )}}{d} + b^{4} x - \frac {b^{4} \tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac {b^{4} \tanh {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tanh {\relax (c )}\right )^{4} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))**4,x)

[Out]

Piecewise((a**4*x + 4*a**3*b*x - 4*a**3*b*log(tanh(c + d*x) + 1)/d + 6*a**2*b**2*x - 6*a**2*b**2*tanh(c + d*x)
/d + 4*a*b**3*x - 4*a*b**3*log(tanh(c + d*x) + 1)/d - 2*a*b**3*tanh(c + d*x)**2/d + b**4*x - b**4*tanh(c + d*x
)**3/(3*d) - b**4*tanh(c + d*x)/d, Ne(d, 0)), (x*(a + b*tanh(c))**4, True))

________________________________________________________________________________________