3.85 $$\int \text{sech}(c+d x) (a+b \tanh ^2(c+d x)) \, dx$$

Optimal. Leaf size=40 $\frac{(2 a+b) \tan ^{-1}(\sinh (c+d x))}{2 d}-\frac{b \tanh (c+d x) \text{sech}(c+d x)}{2 d}$

[Out]

((2*a + b)*ArcTan[Sinh[c + d*x]])/(2*d) - (b*Sech[c + d*x]*Tanh[c + d*x])/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0310208, antiderivative size = 40, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 19, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.158, Rules used = {3676, 385, 203} $\frac{(2 a+b) \tan ^{-1}(\sinh (c+d x))}{2 d}-\frac{b \tanh (c+d x) \text{sech}(c+d x)}{2 d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

((2*a + b)*ArcTan[Sinh[c + d*x]])/(2*d) - (b*Sech[c + d*x]*Tanh[c + d*x])/(2*d)

Rule 3676

Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_))^(p_.), x_Symbol] :> With[{ff = F
reeFactors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 -
ff^2*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n/2] && IntegerQ[p]

Rule 385

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

Rule 203

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

Rubi steps

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

Mathematica [A]  time = 0.0228812, size = 48, normalized size = 1.2 $\frac{a \tan ^{-1}(\sinh (c+d x))}{d}+\frac{b \tan ^{-1}(\sinh (c+d x))}{2 d}-\frac{b \tanh (c+d x) \text{sech}(c+d x)}{2 d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(a*ArcTan[Sinh[c + d*x]])/d + (b*ArcTan[Sinh[c + d*x]])/(2*d) - (b*Sech[c + d*x]*Tanh[c + d*x])/(2*d)

________________________________________________________________________________________

Maple [A]  time = 0.026, size = 65, normalized size = 1.6 \begin{align*} 2\,{\frac{a\arctan \left ({{\rm e}^{dx+c}} \right ) }{d}}-{\frac{b\sinh \left ( dx+c \right ) }{d \left ( \cosh \left ( dx+c \right ) \right ) ^{2}}}+{\frac{b{\rm sech} \left (dx+c\right )\tanh \left ( dx+c \right ) }{2\,d}}+{\frac{b\arctan \left ({{\rm e}^{dx+c}} \right ) }{d}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [B]  time = 1.64965, size = 108, normalized size = 2.7 \begin{align*} -b{\left (\frac{\arctan \left (e^{\left (-d x - c\right )}\right )}{d} + \frac{e^{\left (-d x - c\right )} - e^{\left (-3 \, d x - 3 \, 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 \arctan \left (\sinh \left (d x + c\right )\right )}{d} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-b*(arctan(e^(-d*x - c))/d + (e^(-d*x - c) - e^(-3*d*x - 3*c))/(d*(2*e^(-2*d*x - 2*c) + e^(-4*d*x - 4*c) + 1))
) + a*arctan(sinh(d*x + c))/d

________________________________________________________________________________________

Fricas [B]  time = 1.9605, size = 883, normalized size = 22.08 \begin{align*} -\frac{b \cosh \left (d x + c\right )^{3} + 3 \, b \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{2} + b \sinh \left (d x + c\right )^{3} -{\left ({\left (2 \, a + b\right )} \cosh \left (d x + c\right )^{4} + 4 \,{\left (2 \, a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} +{\left (2 \, a + b\right )} \sinh \left (d x + c\right )^{4} + 2 \,{\left (2 \, a + b\right )} \cosh \left (d x + c\right )^{2} + 2 \,{\left (3 \,{\left (2 \, a + b\right )} \cosh \left (d x + c\right )^{2} + 2 \, a + b\right )} \sinh \left (d x + c\right )^{2} + 4 \,{\left ({\left (2 \, a + b\right )} \cosh \left (d x + c\right )^{3} +{\left (2 \, a + b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + 2 \, a + b\right )} \arctan \left (\cosh \left (d x + c\right ) + \sinh \left (d x + c\right )\right ) - b \cosh \left (d x + c\right ) +{\left (3 \, b \cosh \left (d x + c\right )^{2} - b\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} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(b*cosh(d*x + c)^3 + 3*b*cosh(d*x + c)*sinh(d*x + c)^2 + b*sinh(d*x + c)^3 - ((2*a + b)*cosh(d*x + c)^4 + 4*(
2*a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (2*a + b)*sinh(d*x + c)^4 + 2*(2*a + b)*cosh(d*x + c)^2 + 2*(3*(2*a +
b)*cosh(d*x + c)^2 + 2*a + b)*sinh(d*x + c)^2 + 4*((2*a + b)*cosh(d*x + c)^3 + (2*a + b)*cosh(d*x + c))*sinh(
d*x + c) + 2*a + b)*arctan(cosh(d*x + c) + sinh(d*x + c)) - b*cosh(d*x + c) + (3*b*cosh(d*x + c)^2 - b)*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)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tanh ^{2}{\left (c + d x \right )}\right ) \operatorname{sech}{\left (c + d x \right )}\, dx \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral((a + b*tanh(c + d*x)**2)*sech(c + d*x), x)

________________________________________________________________________________________

Giac [A]  time = 1.21055, size = 85, normalized size = 2.12 \begin{align*} \frac{{\left (2 \, a e^{c} + b e^{c}\right )} \arctan \left (e^{\left (d x + c\right )}\right ) e^{\left (-c\right )} - \frac{b e^{\left (3 \, d x + 3 \, c\right )} - b e^{\left (d x + c\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{2}}}{d} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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