3.1.89 \(\int (a+b \text {sech}(c+d x))^2 \, dx\) [89]

Optimal. Leaf size=33 \[ a^2 x+\frac {2 a b \text {ArcTan}(\sinh (c+d x))}{d}+\frac {b^2 \tanh (c+d x)}{d} \]

[Out]

a^2*x+2*a*b*arctan(sinh(d*x+c))/d+b^2*tanh(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 33, 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 = {3858, 3855, 3852, 8} \begin {gather*} a^2 x+\frac {2 a b \text {ArcTan}(\sinh (c+d x))}{d}+\frac {b^2 \tanh (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

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

Rule 3858

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Simp[a^2*x, x] + (Dist[2*a*b, Int[Csc[c + d*x], x],
 x] + Dist[b^2, Int[Csc[c + d*x]^2, x], x]) /; FreeQ[{a, b, c, d}, x]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 32, normalized size = 0.97 \begin {gather*} \frac {a (a d x+2 b \text {ArcTan}(\sinh (c+d x)))+b^2 \tanh (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [C] Result contains complex when optimal does not.
time = 1.50, size = 64, normalized size = 1.94

method result size
risch \(a^{2} x -\frac {2 b^{2}}{d \left (1+{\mathrm e}^{2 d x +2 c}\right )}+\frac {2 i b a \ln \left ({\mathrm e}^{d x +c}+i\right )}{d}-\frac {2 i b a \ln \left ({\mathrm e}^{d x +c}-i\right )}{d}\) \(64\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sech(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

a^2*x-2*b^2/d/(1+exp(2*d*x+2*c))+2*I*b*a/d*ln(exp(d*x+c)+I)-2*I*b*a/d*ln(exp(d*x+c)-I)

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 41, normalized size = 1.24 \begin {gather*} a^{2} x + \frac {2 \, a b \arctan \left (\sinh \left (d x + c\right )\right )}{d} + \frac {2 \, b^{2}}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 157 vs. \(2 (33) = 66\).
time = 0.42, size = 157, normalized size = 4.76 \begin {gather*} \frac {a^{2} d x \cosh \left (d x + c\right )^{2} + 2 \, a^{2} d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a^{2} d x \sinh \left (d x + c\right )^{2} + a^{2} d x - 2 \, b^{2} + 4 \, {\left (a b \cosh \left (d x + c\right )^{2} + 2 \, a b \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a b \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 )}{d \cosh \left (d x + c\right )^{2} + 2 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + d \sinh \left (d x + c\right )^{2} + d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.39, size = 43, normalized size = 1.30 \begin {gather*} \frac {{\left (d x + c\right )} a^{2} + 4 \, a b \arctan \left (e^{\left (d x + c\right )}\right ) - \frac {2 \, b^{2}}{e^{\left (2 \, d x + 2 \, c\right )} + 1}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.11, size = 70, normalized size = 2.12 \begin {gather*} a^2\,x-\frac {2\,b^2}{d\,\left ({\mathrm {e}}^{2\,c+2\,d\,x}+1\right )}+\frac {4\,\mathrm {atan}\left (\frac {a\,b\,{\mathrm {e}}^{d\,x}\,{\mathrm {e}}^c\,\sqrt {d^2}}{d\,\sqrt {a^2\,b^2}}\right )\,\sqrt {a^2\,b^2}}{\sqrt {d^2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b/cosh(c + d*x))^2,x)

[Out]

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

________________________________________________________________________________________