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

Optimal. Leaf size=28 \[ \frac{b \tanh (x)}{d}-\frac{(b c-a d) \log (c+d \tanh (x))}{d^2} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0988653, antiderivative size = 28, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {4342, 43} \[ \frac{b \tanh (x)}{d}-\frac{(b c-a d) \log (c+d \tanh (x))}{d^2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 4342

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

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

Mathematica [A]  time = 0.328921, size = 54, normalized size = 1.93 \[ \frac{\cosh (x) (a+b \tanh (x)) ((b c-a d) (\log (\cosh (x))-\log (c \cosh (x)+d \sinh (x)))+b d \tanh (x))}{d^2 (a \cosh (x)+b \sinh (x))} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.042, size = 100, normalized size = 3.6 \begin{align*} 2\,{\frac{\tanh \left ( x/2 \right ) b}{d \left ( \left ( \tanh \left ( x/2 \right ) \right ) ^{2}+1 \right ) }}-{\frac{a}{d}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+1 \right ) }+{\frac{cb}{{d}^{2}}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+1 \right ) }+{\frac{a}{d}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,\tanh \left ( x/2 \right ) d+c \right ) }-{\frac{cb}{{d}^{2}}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,\tanh \left ( x/2 \right ) d+c \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [B]  time = 1.56624, size = 89, normalized size = 3.18 \begin{align*} -b{\left (\frac{c \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{2}} - \frac{c \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{2}} - \frac{2}{d e^{\left (-2 \, x\right )} + d}\right )} + \frac{a \log \left (d \tanh \left (x\right ) + c\right )}{d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.26192, size = 467, normalized size = 16.68 \begin{align*} -\frac{2 \, b d +{\left ({\left (b c - a d\right )} \cosh \left (x\right )^{2} + 2 \,{\left (b c - a d\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (b c - a d\right )} \sinh \left (x\right )^{2} + b c - a d\right )} \log \left (\frac{2 \,{\left (c \cosh \left (x\right ) + d \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) -{\left ({\left (b c - a d\right )} \cosh \left (x\right )^{2} + 2 \,{\left (b c - a d\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (b c - a d\right )} \sinh \left (x\right )^{2} + b c - a d\right )} \log \left (\frac{2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{d^{2} \cosh \left (x\right )^{2} + 2 \, d^{2} \cosh \left (x\right ) \sinh \left (x\right ) + d^{2} \sinh \left (x\right )^{2} + d^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(2*b*d + ((b*c - a*d)*cosh(x)^2 + 2*(b*c - a*d)*cosh(x)*sinh(x) + (b*c - a*d)*sinh(x)^2 + b*c - a*d)*log(2*(c
*cosh(x) + d*sinh(x))/(cosh(x) - sinh(x))) - ((b*c - a*d)*cosh(x)^2 + 2*(b*c - a*d)*cosh(x)*sinh(x) + (b*c - a
*d)*sinh(x)^2 + b*c - a*d)*log(2*cosh(x)/(cosh(x) - sinh(x))))/(d^2*cosh(x)^2 + 2*d^2*cosh(x)*sinh(x) + d^2*si
nh(x)^2 + d^2)

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [B]  time = 1.15344, size = 153, normalized size = 5.46 \begin{align*} -\frac{{\left (b c^{2} - a c d + b c d - a d^{2}\right )} \log \left ({\left | c e^{\left (2 \, x\right )} + d e^{\left (2 \, x\right )} + c - d \right |}\right )}{c d^{2} + d^{3}} + \frac{{\left (b c - a d\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{d^{2}} - \frac{b c e^{\left (2 \, x\right )} - a d e^{\left (2 \, x\right )} + b c - a d + 2 \, b d}{d^{2}{\left (e^{\left (2 \, x\right )} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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