\(\int e^x \tanh (3 x) \, dx\) [219]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [C] (verified)
   Fricas [C] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 8, antiderivative size = 97 \[ \int e^x \tanh (3 x) \, dx=e^x-\frac {2 \arctan \left (e^x\right )}{3}+\frac {1}{3} \arctan \left (\sqrt {3}-2 e^x\right )-\frac {1}{3} \arctan \left (\sqrt {3}+2 e^x\right )+\frac {\log \left (1-\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}}-\frac {\log \left (1+\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}} \]

[Out]

exp(x)-2/3*arctan(exp(x))-1/3*arctan(2*exp(x)-3^(1/2))-1/3*arctan(2*exp(x)+3^(1/2))+1/6*ln(1+exp(2*x)-exp(x)*3
^(1/2))*3^(1/2)-1/6*ln(1+exp(2*x)+exp(x)*3^(1/2))*3^(1/2)

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps used = 12, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {2320, 396, 215, 648, 632, 210, 642, 209} \[ \int e^x \tanh (3 x) \, dx=-\frac {2}{3} \arctan \left (e^x\right )+\frac {1}{3} \arctan \left (\sqrt {3}-2 e^x\right )-\frac {1}{3} \arctan \left (2 e^x+\sqrt {3}\right )+e^x+\frac {\log \left (-\sqrt {3} e^x+e^{2 x}+1\right )}{2 \sqrt {3}}-\frac {\log \left (\sqrt {3} e^x+e^{2 x}+1\right )}{2 \sqrt {3}} \]

[In]

Int[E^x*Tanh[3*x],x]

[Out]

E^x - (2*ArcTan[E^x])/3 + ArcTan[Sqrt[3] - 2*E^x]/3 - ArcTan[Sqrt[3] + 2*E^x]/3 + Log[1 - Sqrt[3]*E^x + E^(2*x
)]/(2*Sqrt[3]) - Log[1 + Sqrt[3]*E^x + E^(2*x)]/(2*Sqrt[3])

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 210

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

Rule 215

Int[((a_) + (b_.)*(x_)^(n_))^(-1), x_Symbol] :> Module[{r = Numerator[Rt[a/b, n]], s = Denominator[Rt[a/b, n]]
, k, u, v}, Simp[u = Int[(r - s*Cos[(2*k - 1)*(Pi/n)]*x)/(r^2 - 2*r*s*Cos[(2*k - 1)*(Pi/n)]*x + s^2*x^2), x] +
 Int[(r + s*Cos[(2*k - 1)*(Pi/n)]*x)/(r^2 + 2*r*s*Cos[(2*k - 1)*(Pi/n)]*x + s^2*x^2), x]; 2*(r^2/(a*n))*Int[1/
(r^2 + s^2*x^2), x] + Dist[2*(r/(a*n)), Sum[u, {k, 1, (n - 2)/4}], x], x]] /; FreeQ[{a, b}, x] && IGtQ[(n - 2)
/4, 0] && PosQ[a/b]

Rule 396

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

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

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*} \text {integral}& = \text {Subst}\left (\int \frac {-1+x^6}{1+x^6} \, dx,x,e^x\right ) \\ & = e^x-2 \text {Subst}\left (\int \frac {1}{1+x^6} \, dx,x,e^x\right ) \\ & = e^x-\frac {2}{3} \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,e^x\right )-\frac {2}{3} \text {Subst}\left (\int \frac {1-\frac {\sqrt {3} x}{2}}{1-\sqrt {3} x+x^2} \, dx,x,e^x\right )-\frac {2}{3} \text {Subst}\left (\int \frac {1+\frac {\sqrt {3} x}{2}}{1+\sqrt {3} x+x^2} \, dx,x,e^x\right ) \\ & = e^x-\frac {2 \arctan \left (e^x\right )}{3}-\frac {1}{6} \text {Subst}\left (\int \frac {1}{1-\sqrt {3} x+x^2} \, dx,x,e^x\right )-\frac {1}{6} \text {Subst}\left (\int \frac {1}{1+\sqrt {3} x+x^2} \, dx,x,e^x\right )+\frac {\text {Subst}\left (\int \frac {-\sqrt {3}+2 x}{1-\sqrt {3} x+x^2} \, dx,x,e^x\right )}{2 \sqrt {3}}-\frac {\text {Subst}\left (\int \frac {\sqrt {3}+2 x}{1+\sqrt {3} x+x^2} \, dx,x,e^x\right )}{2 \sqrt {3}} \\ & = e^x-\frac {2 \arctan \left (e^x\right )}{3}+\frac {\log \left (1-\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}}-\frac {\log \left (1+\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}}+\frac {1}{3} \text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,-\sqrt {3}+2 e^x\right )+\frac {1}{3} \text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,\sqrt {3}+2 e^x\right ) \\ & = e^x-\frac {2 \arctan \left (e^x\right )}{3}+\frac {1}{3} \arctan \left (\sqrt {3}-2 e^x\right )-\frac {1}{3} \arctan \left (\sqrt {3}+2 e^x\right )+\frac {\log \left (1-\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}}-\frac {\log \left (1+\sqrt {3} e^x+e^{2 x}\right )}{2 \sqrt {3}} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.02 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.25 \[ \int e^x \tanh (3 x) \, dx=e^x-2 e^x \operatorname {Hypergeometric2F1}\left (\frac {1}{6},1,\frac {7}{6},-e^{6 x}\right ) \]

[In]

Integrate[E^x*Tanh[3*x],x]

[Out]

E^x - 2*E^x*Hypergeometric2F1[1/6, 1, 7/6, -E^(6*x)]

Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.16 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.48

method result size
risch \({\mathrm e}^{x}+\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (81 \textit {\_Z}^{4}-9 \textit {\_Z}^{2}+1\right )}{\sum }\textit {\_R} \ln \left ({\mathrm e}^{x}-3 \textit {\_R} \right )\right )+\frac {i \ln \left ({\mathrm e}^{x}-i\right )}{3}-\frac {i \ln \left ({\mathrm e}^{x}+i\right )}{3}\) \(47\)

[In]

int(exp(x)*tanh(3*x),x,method=_RETURNVERBOSE)

[Out]

exp(x)+sum(_R*ln(exp(x)-3*_R),_R=RootOf(81*_Z^4-9*_Z^2+1))+1/3*I*ln(exp(x)-I)-1/3*I*ln(exp(x)+I)

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.27 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.41 \[ \int e^x \tanh (3 x) \, dx=-\frac {1}{6} \, \sqrt {2 i \, \sqrt {3} + 2} \log \left (\sqrt {2 i \, \sqrt {3} + 2} + 2 \, \cosh \left (x\right ) + 2 \, \sinh \left (x\right )\right ) + \frac {1}{6} \, \sqrt {2 i \, \sqrt {3} + 2} \log \left (-\sqrt {2 i \, \sqrt {3} + 2} + 2 \, \cosh \left (x\right ) + 2 \, \sinh \left (x\right )\right ) - \frac {1}{6} \, \sqrt {-2 i \, \sqrt {3} + 2} \log \left (\sqrt {-2 i \, \sqrt {3} + 2} + 2 \, \cosh \left (x\right ) + 2 \, \sinh \left (x\right )\right ) + \frac {1}{6} \, \sqrt {-2 i \, \sqrt {3} + 2} \log \left (-\sqrt {-2 i \, \sqrt {3} + 2} + 2 \, \cosh \left (x\right ) + 2 \, \sinh \left (x\right )\right ) - \frac {2}{3} \, \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + \cosh \left (x\right ) + \sinh \left (x\right ) \]

[In]

integrate(exp(x)*tanh(3*x),x, algorithm="fricas")

[Out]

-1/6*sqrt(2*I*sqrt(3) + 2)*log(sqrt(2*I*sqrt(3) + 2) + 2*cosh(x) + 2*sinh(x)) + 1/6*sqrt(2*I*sqrt(3) + 2)*log(
-sqrt(2*I*sqrt(3) + 2) + 2*cosh(x) + 2*sinh(x)) - 1/6*sqrt(-2*I*sqrt(3) + 2)*log(sqrt(-2*I*sqrt(3) + 2) + 2*co
sh(x) + 2*sinh(x)) + 1/6*sqrt(-2*I*sqrt(3) + 2)*log(-sqrt(-2*I*sqrt(3) + 2) + 2*cosh(x) + 2*sinh(x)) - 2/3*arc
tan(cosh(x) + sinh(x)) + cosh(x) + sinh(x)

Sympy [F]

\[ \int e^x \tanh (3 x) \, dx=\int e^{x} \tanh {\left (3 x \right )}\, dx \]

[In]

integrate(exp(x)*tanh(3*x),x)

[Out]

Integral(exp(x)*tanh(3*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.71 \[ \int e^x \tanh (3 x) \, dx=-\frac {1}{6} \, \sqrt {3} \log \left (\sqrt {3} e^{x} + e^{\left (2 \, x\right )} + 1\right ) + \frac {1}{6} \, \sqrt {3} \log \left (-\sqrt {3} e^{x} + e^{\left (2 \, x\right )} + 1\right ) - \frac {1}{3} \, \arctan \left (\sqrt {3} + 2 \, e^{x}\right ) - \frac {1}{3} \, \arctan \left (-\sqrt {3} + 2 \, e^{x}\right ) - \frac {2}{3} \, \arctan \left (e^{x}\right ) + e^{x} \]

[In]

integrate(exp(x)*tanh(3*x),x, algorithm="maxima")

[Out]

-1/6*sqrt(3)*log(sqrt(3)*e^x + e^(2*x) + 1) + 1/6*sqrt(3)*log(-sqrt(3)*e^x + e^(2*x) + 1) - 1/3*arctan(sqrt(3)
 + 2*e^x) - 1/3*arctan(-sqrt(3) + 2*e^x) - 2/3*arctan(e^x) + e^x

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.71 \[ \int e^x \tanh (3 x) \, dx=-\frac {1}{6} \, \sqrt {3} \log \left (\sqrt {3} e^{x} + e^{\left (2 \, x\right )} + 1\right ) + \frac {1}{6} \, \sqrt {3} \log \left (-\sqrt {3} e^{x} + e^{\left (2 \, x\right )} + 1\right ) - \frac {1}{3} \, \arctan \left (\sqrt {3} + 2 \, e^{x}\right ) - \frac {1}{3} \, \arctan \left (-\sqrt {3} + 2 \, e^{x}\right ) - \frac {2}{3} \, \arctan \left (e^{x}\right ) + e^{x} \]

[In]

integrate(exp(x)*tanh(3*x),x, algorithm="giac")

[Out]

-1/6*sqrt(3)*log(sqrt(3)*e^x + e^(2*x) + 1) + 1/6*sqrt(3)*log(-sqrt(3)*e^x + e^(2*x) + 1) - 1/3*arctan(sqrt(3)
 + 2*e^x) - 1/3*arctan(-sqrt(3) + 2*e^x) - 2/3*arctan(e^x) + e^x

Mupad [B] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 70, normalized size of antiderivative = 0.72 \[ \int e^x \tanh (3 x) \, dx={\mathrm {e}}^x-\frac {\mathrm {atan}\left (2\,{\mathrm {e}}^x+\sqrt {3}\right )}{3}-\frac {\mathrm {atan}\left (2\,{\mathrm {e}}^x-\sqrt {3}\right )}{3}-\frac {2\,\mathrm {atan}\left ({\mathrm {e}}^x\right )}{3}+\frac {\sqrt {3}\,\ln \left ({\left (2\,{\mathrm {e}}^x-\sqrt {3}\right )}^2+1\right )}{6}-\frac {\sqrt {3}\,\ln \left ({\left (2\,{\mathrm {e}}^x+\sqrt {3}\right )}^2+1\right )}{6} \]

[In]

int(tanh(3*x)*exp(x),x)

[Out]

exp(x) - atan(2*exp(x) + 3^(1/2))/3 - atan(2*exp(x) - 3^(1/2))/3 - (2*atan(exp(x)))/3 + (3^(1/2)*log((2*exp(x)
 - 3^(1/2))^2 + 1))/6 - (3^(1/2)*log((2*exp(x) + 3^(1/2))^2 + 1))/6