3.3.8 \(\int e^{a+b x} \tanh ^2(a+b x) \, dx\) [208]

Optimal. Leaf size=51 \[ \frac {e^{a+b x}}{b}+\frac {2 e^{a+b x}}{b \left (1+e^{2 a+2 b x}\right )}-\frac {2 \text {ArcTan}\left (e^{a+b x}\right )}{b} \]

[Out]

exp(b*x+a)/b+2*exp(b*x+a)/b/(1+exp(2*b*x+2*a))-2*arctan(exp(b*x+a))/b

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2320, 398, 294, 209} \begin {gather*} -\frac {2 \text {ArcTan}\left (e^{a+b x}\right )}{b}+\frac {e^{a+b x}}{b}+\frac {2 e^{a+b x}}{b \left (e^{2 a+2 b x}+1\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[E^(a + b*x)*Tanh[a + b*x]^2,x]

[Out]

E^(a + b*x)/b + (2*E^(a + b*x))/(b*(1 + E^(2*a + 2*b*x))) - (2*ArcTan[E^(a + b*x)])/b

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 398

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 2320

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rubi steps

\begin {align*} \int e^{a+b x} \tanh ^2(a+b x) \, dx &=\frac {\text {Subst}\left (\int \frac {\left (1-x^2\right )^2}{\left (1+x^2\right )^2} \, dx,x,e^{a+b x}\right )}{b}\\ &=\frac {\text {Subst}\left (\int \left (1-\frac {4 x^2}{\left (1+x^2\right )^2}\right ) \, dx,x,e^{a+b x}\right )}{b}\\ &=\frac {e^{a+b x}}{b}-\frac {4 \text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right )^2} \, dx,x,e^{a+b x}\right )}{b}\\ &=\frac {e^{a+b x}}{b}+\frac {2 e^{a+b x}}{b \left (1+e^{2 a+2 b x}\right )}-\frac {2 \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,e^{a+b x}\right )}{b}\\ &=\frac {e^{a+b x}}{b}+\frac {2 e^{a+b x}}{b \left (1+e^{2 a+2 b x}\right )}-\frac {2 \tan ^{-1}\left (e^{a+b x}\right )}{b}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 40, normalized size = 0.78 \begin {gather*} \frac {e^{a+b x} \left (1+\frac {2}{1+e^{2 (a+b x)}}\right )-2 \text {ArcTan}\left (e^{a+b x}\right )}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[E^(a + b*x)*Tanh[a + b*x]^2,x]

[Out]

(E^(a + b*x)*(1 + 2/(1 + E^(2*(a + b*x)))) - 2*ArcTan[E^(a + b*x)])/b

________________________________________________________________________________________

Maple [A]
time = 0.45, size = 48, normalized size = 0.94

method result size
derivativedivides \(\frac {\frac {\sinh ^{2}\left (b x +a \right )}{\cosh \left (b x +a \right )}+\frac {2}{\cosh \left (b x +a \right )}+\sinh \left (b x +a \right )-2 \arctan \left ({\mathrm e}^{b x +a}\right )}{b}\) \(48\)
default \(\frac {\frac {\sinh ^{2}\left (b x +a \right )}{\cosh \left (b x +a \right )}+\frac {2}{\cosh \left (b x +a \right )}+\sinh \left (b x +a \right )-2 \arctan \left ({\mathrm e}^{b x +a}\right )}{b}\) \(48\)
risch \(\frac {{\mathrm e}^{b x +a}}{b}+\frac {2 \,{\mathrm e}^{b x +a}}{b \left ({\mathrm e}^{2 b x +2 a}+1\right )}+\frac {i \ln \left ({\mathrm e}^{b x +a}-i\right )}{b}-\frac {i \ln \left ({\mathrm e}^{b x +a}+i\right )}{b}\) \(68\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(exp(b*x+a)*tanh(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/b*(sinh(b*x+a)^2/cosh(b*x+a)+2/cosh(b*x+a)+sinh(b*x+a)-2*arctan(exp(b*x+a)))

________________________________________________________________________________________

Maxima [A]
time = 0.46, size = 47, normalized size = 0.92 \begin {gather*} -\frac {2 \, \arctan \left (e^{\left (b x + a\right )}\right )}{b} + \frac {e^{\left (b x + a\right )}}{b} + \frac {2 \, e^{\left (b x + a\right )}}{b {\left (e^{\left (2 \, b x + 2 \, a\right )} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(b*x+a)*tanh(b*x+a)^2,x, algorithm="maxima")

[Out]

-2*arctan(e^(b*x + a))/b + e^(b*x + a)/b + 2*e^(b*x + a)/(b*(e^(2*b*x + 2*a) + 1))

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 147 vs. \(2 (47) = 94\).
time = 0.33, size = 147, normalized size = 2.88 \begin {gather*} \frac {\cosh \left (b x + a\right )^{3} + 3 \, \cosh \left (b x + a\right ) \sinh \left (b x + a\right )^{2} + \sinh \left (b x + a\right )^{3} - 2 \, {\left (\cosh \left (b x + a\right )^{2} + 2 \, \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + \sinh \left (b x + a\right )^{2} + 1\right )} \arctan \left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right )\right ) + 3 \, {\left (\cosh \left (b x + a\right )^{2} + 1\right )} \sinh \left (b x + a\right ) + 3 \, \cosh \left (b x + a\right )}{b \cosh \left (b x + a\right )^{2} + 2 \, b \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + b \sinh \left (b x + a\right )^{2} + b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(b*x+a)*tanh(b*x+a)^2,x, algorithm="fricas")

[Out]

(cosh(b*x + a)^3 + 3*cosh(b*x + a)*sinh(b*x + a)^2 + sinh(b*x + a)^3 - 2*(cosh(b*x + a)^2 + 2*cosh(b*x + a)*si
nh(b*x + a) + sinh(b*x + a)^2 + 1)*arctan(cosh(b*x + a) + sinh(b*x + a)) + 3*(cosh(b*x + a)^2 + 1)*sinh(b*x +
a) + 3*cosh(b*x + a))/(b*cosh(b*x + a)^2 + 2*b*cosh(b*x + a)*sinh(b*x + a) + b*sinh(b*x + a)^2 + b)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} e^{a} \int e^{b x} \tanh ^{2}{\left (a + b x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(b*x+a)*tanh(b*x+a)**2,x)

[Out]

exp(a)*Integral(exp(b*x)*tanh(a + b*x)**2, x)

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 41, normalized size = 0.80 \begin {gather*} \frac {\frac {2 \, e^{\left (b x + a\right )}}{e^{\left (2 \, b x + 2 \, a\right )} + 1} - 2 \, \arctan \left (e^{\left (b x + a\right )}\right ) + e^{\left (b x + a\right )}}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(b*x+a)*tanh(b*x+a)^2,x, algorithm="giac")

[Out]

(2*e^(b*x + a)/(e^(2*b*x + 2*a) + 1) - 2*arctan(e^(b*x + a)) + e^(b*x + a))/b

________________________________________________________________________________________

Mupad [B]
time = 1.07, size = 58, normalized size = 1.14 \begin {gather*} \frac {{\mathrm {e}}^{a+b\,x}}{b}-\frac {2\,\mathrm {atan}\left (\frac {{\mathrm {e}}^{b\,x}\,{\mathrm {e}}^a\,\sqrt {b^2}}{b}\right )}{\sqrt {b^2}}+\frac {2\,{\mathrm {e}}^{a+b\,x}}{b\,\left ({\mathrm {e}}^{2\,a+2\,b\,x}+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(exp(a + b*x)*tanh(a + b*x)^2,x)

[Out]

exp(a + b*x)/b - (2*atan((exp(b*x)*exp(a)*(b^2)^(1/2))/b))/(b^2)^(1/2) + (2*exp(a + b*x))/(b*(exp(2*a + 2*b*x)
 + 1))

________________________________________________________________________________________