Integrand size = 21, antiderivative size = 52 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=\frac {(b c-a d)^2 \log (c+d \tanh (x))}{d^3}-\frac {b (b c-2 a d) \tanh (x)}{d^2}+\frac {b^2 \tanh ^2(x)}{2 d} \] Output:
(-a*d+b*c)^2*ln(c+d*tanh(x))/d^3-b*(-2*a*d+b*c)*tanh(x)/d^2+1/2*b^2*tanh(x )^2/d
Time = 0.26 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=-\frac {-2 (b c-a d)^2 \log (c+d \tanh (x))+b^2 d^2 \text {sech}^2(x)+2 b d (b c-2 a d) \tanh (x)}{2 d^3} \] Input:
Integrate[(Sech[x]^2*(a + b*Tanh[x])^2)/(c + d*Tanh[x]),x]
Output:
-1/2*(-2*(b*c - a*d)^2*Log[c + d*Tanh[x]] + b^2*d^2*Sech[x]^2 + 2*b*d*(b*c - 2*a*d)*Tanh[x])/d^3
Time = 0.37 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.02, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3042, 4842, 49, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sec (i x)^2 (a-i b \tan (i x))^2}{c-i d \tan (i x)}dx\) |
\(\Big \downarrow \) 4842 |
\(\displaystyle \int \frac {(a+b \tanh (x))^2}{c+d \tanh (x)}d\tanh (x)\) |
\(\Big \downarrow \) 49 |
\(\displaystyle \int \left (\frac {(a d-b c)^2}{d^2 (c+d \tanh (x))}-\frac {b (b c-a d)}{d^2}+\frac {b (a+b \tanh (x))}{d}\right )d\tanh (x)\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {(b c-a d)^2 \log (c+d \tanh (x))}{d^3}-\frac {b \tanh (x) (b c-a d)}{d^2}+\frac {(a+b \tanh (x))^2}{2 d}\) |
Input:
Int[(Sech[x]^2*(a + b*Tanh[x])^2)/(c + d*Tanh[x]),x]
Output:
((b*c - a*d)^2*Log[c + d*Tanh[x]])/d^3 - (b*(b*c - a*d)*Tanh[x])/d^2 + (a + b*Tanh[x])^2/(2*d)
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}, x] && IGtQ[m, 0] && IGtQ[m + n + 2, 0]
Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFac tors[Tan[c*(a + b*x)], x]}, Simp[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])
Time = 4.34 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.15
method | result | size |
derivativedivides | \(\frac {b \left (\frac {\tanh \left (x \right )^{2} b d}{2}+2 \tanh \left (x \right ) a d -\tanh \left (x \right ) b c \right )}{d^{2}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (c +d \tanh \left (x \right )\right )}{d^{3}}\) | \(60\) |
default | \(\frac {b \left (\frac {\tanh \left (x \right )^{2} b d}{2}+2 \tanh \left (x \right ) a d -\tanh \left (x \right ) b c \right )}{d^{2}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (c +d \tanh \left (x \right )\right )}{d^{3}}\) | \(60\) |
risch | \(-\frac {2 b \left (2 a d \,{\mathrm e}^{2 x}-{\mathrm e}^{2 x} b c +b d \,{\mathrm e}^{2 x}+2 a d -b c \right )}{\left (1+{\mathrm e}^{2 x}\right )^{2} d^{2}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) a^{2}}{d}-\frac {2 \ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) a b c}{d^{2}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {c -d}{c +d}\right ) b^{2} c^{2}}{d^{3}}-\frac {\ln \left (1+{\mathrm e}^{2 x}\right ) a^{2}}{d}+\frac {2 \ln \left (1+{\mathrm e}^{2 x}\right ) a b c}{d^{2}}-\frac {\ln \left (1+{\mathrm e}^{2 x}\right ) b^{2} c^{2}}{d^{3}}\) | \(172\) |
Input:
int(sech(x)^2*(a+b*tanh(x))^2/(c+d*tanh(x)),x,method=_RETURNVERBOSE)
Output:
b/d^2*(1/2*tanh(x)^2*b*d+2*tanh(x)*a*d-tanh(x)*b*c)+(a^2*d^2-2*a*b*c*d+b^2 *c^2)/d^3*ln(c+d*tanh(x))
Leaf count of result is larger than twice the leaf count of optimal. 688 vs. \(2 (50) = 100\).
Time = 0.13 (sec) , antiderivative size = 688, normalized size of antiderivative = 13.23 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx =\text {Too large to display} \] Input:
integrate(sech(x)^2*(a+b*tanh(x))^2/(c+d*tanh(x)),x, algorithm="fricas")
Output:
(2*b^2*c*d - 4*a*b*d^2 + 2*(b^2*c*d - (2*a*b + b^2)*d^2)*cosh(x)^2 + 4*(b^ 2*c*d - (2*a*b + b^2)*d^2)*cosh(x)*sinh(x) + 2*(b^2*c*d - (2*a*b + b^2)*d^ 2)*sinh(x)^2 + ((b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)^4 + 4*(b^2*c^2 - 2 *a*b*c*d + a^2*d^2)*cosh(x)*sinh(x)^3 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*si nh(x)^4 + b^2*c^2 - 2*a*b*c*d + a^2*d^2 + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2 )*cosh(x)^2 + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2 + 3*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)^2)*sinh(x)^2 + 4*((b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x) ^3 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x))*sinh(x))*log(2*(c*cosh(x) + d*sinh(x))/(cosh(x) - sinh(x))) - ((b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x) ^4 + 4*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)*sinh(x)^3 + (b^2*c^2 - 2*a* b*c*d + a^2*d^2)*sinh(x)^4 + b^2*c^2 - 2*a*b*c*d + a^2*d^2 + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)^2 + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2 + 3*(b^2 *c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)^2)*sinh(x)^2 + 4*((b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x)^3 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cosh(x))*sinh(x))* log(2*cosh(x)/(cosh(x) - sinh(x))))/(d^3*cosh(x)^4 + 4*d^3*cosh(x)*sinh(x) ^3 + d^3*sinh(x)^4 + 2*d^3*cosh(x)^2 + d^3 + 2*(3*d^3*cosh(x)^2 + d^3)*sin h(x)^2 + 4*(d^3*cosh(x)^3 + d^3*cosh(x))*sinh(x))
\[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=\int \frac {\left (a + b \tanh {\left (x \right )}\right )^{2} \operatorname {sech}^{2}{\left (x \right )}}{c + d \tanh {\left (x \right )}}\, dx \] Input:
integrate(sech(x)**2*(a+b*tanh(x))**2/(c+d*tanh(x)),x)
Output:
Integral((a + b*tanh(x))**2*sech(x)**2/(c + d*tanh(x)), x)
Leaf count of result is larger than twice the leaf count of optimal. 151 vs. \(2 (50) = 100\).
Time = 0.13 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.90 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=-b^{2} {\left (\frac {2 \, {\left ({\left (c + d\right )} e^{\left (-2 \, x\right )} + c\right )}}{2 \, d^{2} e^{\left (-2 \, x\right )} + d^{2} e^{\left (-4 \, x\right )} + d^{2}} - \frac {c^{2} \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{3}} + \frac {c^{2} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{3}}\right )} - 2 \, a 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^{2} \log \left (d \tanh \left (x\right ) + c\right )}{d} \] Input:
integrate(sech(x)^2*(a+b*tanh(x))^2/(c+d*tanh(x)),x, algorithm="maxima")
Output:
-b^2*(2*((c + d)*e^(-2*x) + c)/(2*d^2*e^(-2*x) + d^2*e^(-4*x) + d^2) - c^2 *log(-(c - d)*e^(-2*x) - c - d)/d^3 + c^2*log(e^(-2*x) + 1)/d^3) - 2*a*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^2*log(d*tanh(x) + c)/d
Leaf count of result is larger than twice the leaf count of optimal. 264 vs. \(2 (50) = 100\).
Time = 0.12 (sec) , antiderivative size = 264, normalized size of antiderivative = 5.08 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=\frac {{\left (b^{2} c^{3} - 2 \, a b c^{2} d + b^{2} c^{2} d + a^{2} c d^{2} - 2 \, a b c d^{2} + a^{2} d^{3}\right )} \log \left ({\left | c e^{\left (2 \, x\right )} + d e^{\left (2 \, x\right )} + c - d \right |}\right )}{c d^{3} + d^{4}} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{d^{3}} + \frac {3 \, b^{2} c^{2} e^{\left (4 \, x\right )} - 6 \, a b c d e^{\left (4 \, x\right )} + 3 \, a^{2} d^{2} e^{\left (4 \, x\right )} + 6 \, b^{2} c^{2} e^{\left (2 \, x\right )} - 12 \, a b c d e^{\left (2 \, x\right )} + 4 \, b^{2} c d e^{\left (2 \, x\right )} + 6 \, a^{2} d^{2} e^{\left (2 \, x\right )} - 8 \, a b d^{2} e^{\left (2 \, x\right )} - 4 \, b^{2} d^{2} e^{\left (2 \, x\right )} + 3 \, b^{2} c^{2} - 6 \, a b c d + 4 \, b^{2} c d + 3 \, a^{2} d^{2} - 8 \, a b d^{2}}{2 \, d^{3} {\left (e^{\left (2 \, x\right )} + 1\right )}^{2}} \] Input:
integrate(sech(x)^2*(a+b*tanh(x))^2/(c+d*tanh(x)),x, algorithm="giac")
Output:
(b^2*c^3 - 2*a*b*c^2*d + b^2*c^2*d + a^2*c*d^2 - 2*a*b*c*d^2 + a^2*d^3)*lo g(abs(c*e^(2*x) + d*e^(2*x) + c - d))/(c*d^3 + d^4) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(e^(2*x) + 1)/d^3 + 1/2*(3*b^2*c^2*e^(4*x) - 6*a*b*c*d*e^(4 *x) + 3*a^2*d^2*e^(4*x) + 6*b^2*c^2*e^(2*x) - 12*a*b*c*d*e^(2*x) + 4*b^2*c *d*e^(2*x) + 6*a^2*d^2*e^(2*x) - 8*a*b*d^2*e^(2*x) - 4*b^2*d^2*e^(2*x) + 3 *b^2*c^2 - 6*a*b*c*d + 4*b^2*c*d + 3*a^2*d^2 - 8*a*b*d^2)/(d^3*(e^(2*x) + 1)^2)
Time = 1.32 (sec) , antiderivative size = 107, normalized size of antiderivative = 2.06 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=\frac {\ln \left (c-d+d\,{\mathrm {e}}^{2\,x}+c\,{\mathrm {e}}^{2\,x}\right )\,{\left (a\,d-b\,c\right )}^2}{d^3}-\frac {2\,\left (b^2\,d-b^2\,c+2\,a\,b\,d\right )}{d^2\,\left ({\mathrm {e}}^{2\,x}+1\right )}-\frac {\ln \left ({\mathrm {e}}^{2\,x}+1\right )\,{\left (a\,d-b\,c\right )}^2}{d^3}+\frac {2\,b^2}{d\,\left (2\,{\mathrm {e}}^{2\,x}+{\mathrm {e}}^{4\,x}+1\right )} \] Input:
int((a + b*tanh(x))^2/(cosh(x)^2*(c + d*tanh(x))),x)
Output:
(log(c - d + d*exp(2*x) + c*exp(2*x))*(a*d - b*c)^2)/d^3 - (2*(b^2*d - b^2 *c + 2*a*b*d))/(d^2*(exp(2*x) + 1)) - (log(exp(2*x) + 1)*(a*d - b*c)^2)/d^ 3 + (2*b^2)/(d*(2*exp(2*x) + exp(4*x) + 1))
Time = 0.22 (sec) , antiderivative size = 517, normalized size of antiderivative = 9.94 \[ \int \frac {\text {sech}^2(x) (a+b \tanh (x))^2}{c+d \tanh (x)} \, dx=\frac {-e^{4 x} \mathrm {log}\left (e^{2 x}+1\right ) a^{2} d^{2}+2 e^{4 x} \mathrm {log}\left (e^{2 x}+1\right ) a b c d -e^{4 x} \mathrm {log}\left (e^{2 x}+1\right ) b^{2} c^{2}+e^{4 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a^{2} d^{2}-2 e^{4 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a b c d +e^{4 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) b^{2} c^{2}+2 e^{4 x} a b \,d^{2}-e^{4 x} b^{2} c d +e^{4 x} b^{2} d^{2}-2 e^{2 x} \mathrm {log}\left (e^{2 x}+1\right ) a^{2} d^{2}+4 e^{2 x} \mathrm {log}\left (e^{2 x}+1\right ) a b c d -2 e^{2 x} \mathrm {log}\left (e^{2 x}+1\right ) b^{2} c^{2}+2 e^{2 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a^{2} d^{2}-4 e^{2 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a b c d +2 e^{2 x} \mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) b^{2} c^{2}-\mathrm {log}\left (e^{2 x}+1\right ) a^{2} d^{2}+2 \,\mathrm {log}\left (e^{2 x}+1\right ) a b c d -\mathrm {log}\left (e^{2 x}+1\right ) b^{2} c^{2}+\mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a^{2} d^{2}-2 \,\mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) a b c d +\mathrm {log}\left (e^{2 x} c +e^{2 x} d +c -d \right ) b^{2} c^{2}-2 a b \,d^{2}+b^{2} c d +b^{2} d^{2}}{d^{3} \left (e^{4 x}+2 e^{2 x}+1\right )} \] Input:
int(sech(x)^2*(a+b*tanh(x))^2/(c+d*tanh(x)),x)
Output:
( - e**(4*x)*log(e**(2*x) + 1)*a**2*d**2 + 2*e**(4*x)*log(e**(2*x) + 1)*a* b*c*d - e**(4*x)*log(e**(2*x) + 1)*b**2*c**2 + e**(4*x)*log(e**(2*x)*c + e **(2*x)*d + c - d)*a**2*d**2 - 2*e**(4*x)*log(e**(2*x)*c + e**(2*x)*d + c - d)*a*b*c*d + e**(4*x)*log(e**(2*x)*c + e**(2*x)*d + c - d)*b**2*c**2 + 2 *e**(4*x)*a*b*d**2 - e**(4*x)*b**2*c*d + e**(4*x)*b**2*d**2 - 2*e**(2*x)*l og(e**(2*x) + 1)*a**2*d**2 + 4*e**(2*x)*log(e**(2*x) + 1)*a*b*c*d - 2*e**( 2*x)*log(e**(2*x) + 1)*b**2*c**2 + 2*e**(2*x)*log(e**(2*x)*c + e**(2*x)*d + c - d)*a**2*d**2 - 4*e**(2*x)*log(e**(2*x)*c + e**(2*x)*d + c - d)*a*b*c *d + 2*e**(2*x)*log(e**(2*x)*c + e**(2*x)*d + c - d)*b**2*c**2 - log(e**(2 *x) + 1)*a**2*d**2 + 2*log(e**(2*x) + 1)*a*b*c*d - log(e**(2*x) + 1)*b**2* c**2 + log(e**(2*x)*c + e**(2*x)*d + c - d)*a**2*d**2 - 2*log(e**(2*x)*c + e**(2*x)*d + c - d)*a*b*c*d + log(e**(2*x)*c + e**(2*x)*d + c - d)*b**2*c **2 - 2*a*b*d**2 + b**2*c*d + b**2*d**2)/(d**3*(e**(4*x) + 2*e**(2*x) + 1) )