Integrand size = 23, antiderivative size = 46 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {x}{a+b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b) d} \] Output:
x/(a+b)-a^(1/2)*arctan(b^(1/2)*tanh(d*x+c)/a^(1/2))/b^(1/2)/(a+b)/d
Time = 0.02 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.02 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b}}+\text {arctanh}(\tanh (c+d x))}{(a+b) d} \] Input:
Integrate[Tanh[c + d*x]^2/(a + b*Tanh[c + d*x]^2),x]
Output:
(-((Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/Sqrt[b]) + ArcTanh[Ta nh[c + d*x]])/((a + b)*d)
Time = 0.47 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.17, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.304, Rules used = {3042, 25, 4153, 25, 383, 218, 219}
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 {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -\frac {\tan (i c+i d x)^2}{a-b \tan (i c+i d x)^2}dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int \frac {\tan (i c+i d x)^2}{a-b \tan (i c+i d x)^2}dx\) |
\(\Big \downarrow \) 4153 |
\(\displaystyle -\frac {\int -\frac {\tanh ^2(c+d x)}{\left (1-\tanh ^2(c+d x)\right ) \left (b \tanh ^2(c+d x)+a\right )}d\tanh (c+d x)}{d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\int \frac {\tanh ^2(c+d x)}{\left (1-\tanh ^2(c+d x)\right ) \left (b \tanh ^2(c+d x)+a\right )}d\tanh (c+d x)}{d}\) |
\(\Big \downarrow \) 383 |
\(\displaystyle -\frac {\frac {a \int \frac {1}{b \tanh ^2(c+d x)+a}d\tanh (c+d x)}{a+b}-\frac {\int \frac {1}{1-\tanh ^2(c+d x)}d\tanh (c+d x)}{a+b}}{d}\) |
\(\Big \downarrow \) 218 |
\(\displaystyle -\frac {\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}-\frac {\int \frac {1}{1-\tanh ^2(c+d x)}d\tanh (c+d x)}{a+b}}{d}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle -\frac {\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}-\frac {\text {arctanh}(\tanh (c+d x))}{a+b}}{d}\) |
Input:
Int[Tanh[c + d*x]^2/(a + b*Tanh[c + d*x]^2),x]
Output:
-(((Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/(Sqrt[b]*(a + b)) - A rcTanh[Tanh[c + d*x]]/(a + b))/d)
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt Q[a, 0] || LtQ[b, 0])
Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_Sym bol] :> Simp[(-a)*(e^2/(b*c - a*d)) Int[(e*x)^(m - 2)/(a + b*x^2), x], x] + Simp[c*(e^2/(b*c - a*d)) Int[(e*x)^(m - 2)/(c + d*x^2), x], x] /; Free Q[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && LeQ[2, m, 3]
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[c*(ff/f) Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio nalQ[n]))
Time = 0.08 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.57
method | result | size |
derivativedivides | \(\frac {-\frac {a \arctan \left (\frac {b \tanh \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a +b \right ) \sqrt {a b}}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right )}{2 a +2 b}-\frac {\ln \left (-1+\tanh \left (d x +c \right )\right )}{2 a +2 b}}{d}\) | \(72\) |
default | \(\frac {-\frac {a \arctan \left (\frac {b \tanh \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a +b \right ) \sqrt {a b}}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right )}{2 a +2 b}-\frac {\ln \left (-1+\tanh \left (d x +c \right )\right )}{2 a +2 b}}{d}\) | \(72\) |
risch | \(\frac {x}{a +b}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 d x +2 c}-\frac {-a +2 \sqrt {-a b}+b}{a +b}\right )}{2 b \left (a +b \right ) d}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 d x +2 c}+\frac {a +2 \sqrt {-a b}-b}{a +b}\right )}{2 b \left (a +b \right ) d}\) | \(108\) |
Input:
int(tanh(d*x+c)^2/(a+b*tanh(d*x+c)^2),x,method=_RETURNVERBOSE)
Output:
1/d*(-a/(a+b)/(a*b)^(1/2)*arctan(b*tanh(d*x+c)/(a*b)^(1/2))+1/(2*a+2*b)*ln (1+tanh(d*x+c))-1/(2*a+2*b)*ln(-1+tanh(d*x+c)))
Leaf count of result is larger than twice the leaf count of optimal. 81 vs. \(2 (38) = 76\).
Time = 0.12 (sec) , antiderivative size = 486, normalized size of antiderivative = 10.57 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\left [\frac {2 \, d x + \sqrt {-\frac {a}{b}} \log \left (\frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a^{2} - b^{2}\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{2} + a^{2} - b^{2}\right )} \sinh \left (d x + c\right )^{2} + a^{2} - 6 \, a b + b^{2} + 4 \, {\left ({\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{3} + {\left (a^{2} - b^{2}\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) - 4 \, {\left ({\left (a b + b^{2}\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (a b + b^{2}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a b + b^{2}\right )} \sinh \left (d x + c\right )^{2} + a b - b^{2}\right )} \sqrt {-\frac {a}{b}}}{{\left (a + b\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a + b\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a - b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} \cosh \left (d x + c\right )^{2} + a - b\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{3} + {\left (a - b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + a + b}\right )}{2 \, {\left (a + b\right )} d}, \frac {d x - \sqrt {\frac {a}{b}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a + b\right )} \sinh \left (d x + c\right )^{2} + a - b\right )} \sqrt {\frac {a}{b}}}{2 \, a}\right )}{{\left (a + b\right )} d}\right ] \] Input:
integrate(tanh(d*x+c)^2/(a+b*tanh(d*x+c)^2),x, algorithm="fricas")
Output:
[1/2*(2*d*x + sqrt(-a/b)*log(((a^2 + 2*a*b + b^2)*cosh(d*x + c)^4 + 4*(a^2 + 2*a*b + b^2)*cosh(d*x + c)*sinh(d*x + c)^3 + (a^2 + 2*a*b + b^2)*sinh(d *x + c)^4 + 2*(a^2 - b^2)*cosh(d*x + c)^2 + 2*(3*(a^2 + 2*a*b + b^2)*cosh( d*x + c)^2 + a^2 - b^2)*sinh(d*x + c)^2 + a^2 - 6*a*b + b^2 + 4*((a^2 + 2* a*b + b^2)*cosh(d*x + c)^3 + (a^2 - b^2)*cosh(d*x + c))*sinh(d*x + c) - 4* ((a*b + b^2)*cosh(d*x + c)^2 + 2*(a*b + b^2)*cosh(d*x + c)*sinh(d*x + c) + (a*b + b^2)*sinh(d*x + c)^2 + a*b - b^2)*sqrt(-a/b))/((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a + b)*sinh(d*x + c)^4 + 2*(a - b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh(d*x + c)^2 + a - b)*sinh(d* x + c)^2 + 4*((a + b)*cosh(d*x + c)^3 + (a - b)*cosh(d*x + c))*sinh(d*x + c) + a + b)))/((a + b)*d), (d*x - sqrt(a/b)*arctan(1/2*((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)*sqrt(a/b)/a))/((a + b)*d)]
Leaf count of result is larger than twice the leaf count of optimal. 253 vs. \(2 (37) = 74\).
Time = 2.13 (sec) , antiderivative size = 253, normalized size of antiderivative = 5.50 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x - \frac {\tanh {\left (c + d x \right )}}{d}}{a} & \text {for}\: b = 0 \\\frac {x}{b} & \text {for}\: a = 0 \\\frac {d x \tanh ^{2}{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} - \frac {d x}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} + \frac {\tanh {\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} & \text {for}\: a = - b \\\frac {x \tanh ^{2}{\left (c \right )}}{a + b \tanh ^{2}{\left (c \right )}} & \text {for}\: d = 0 \\- \frac {a \log {\left (- \sqrt {- \frac {a}{b}} + \tanh {\left (c + d x \right )} \right )}}{2 a b d \sqrt {- \frac {a}{b}} + 2 b^{2} d \sqrt {- \frac {a}{b}}} + \frac {a \log {\left (\sqrt {- \frac {a}{b}} + \tanh {\left (c + d x \right )} \right )}}{2 a b d \sqrt {- \frac {a}{b}} + 2 b^{2} d \sqrt {- \frac {a}{b}}} + \frac {2 b d x \sqrt {- \frac {a}{b}}}{2 a b d \sqrt {- \frac {a}{b}} + 2 b^{2} d \sqrt {- \frac {a}{b}}} & \text {otherwise} \end {cases} \] Input:
integrate(tanh(d*x+c)**2/(a+b*tanh(d*x+c)**2),x)
Output:
Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ((x - tanh(c + d*x)/d)/ a, Eq(b, 0)), (x/b, Eq(a, 0)), (d*x*tanh(c + d*x)**2/(2*b*d*tanh(c + d*x)* *2 - 2*b*d) - d*x/(2*b*d*tanh(c + d*x)**2 - 2*b*d) + tanh(c + d*x)/(2*b*d* tanh(c + d*x)**2 - 2*b*d), Eq(a, -b)), (x*tanh(c)**2/(a + b*tanh(c)**2), E q(d, 0)), (-a*log(-sqrt(-a/b) + tanh(c + d*x))/(2*a*b*d*sqrt(-a/b) + 2*b** 2*d*sqrt(-a/b)) + a*log(sqrt(-a/b) + tanh(c + d*x))/(2*a*b*d*sqrt(-a/b) + 2*b**2*d*sqrt(-a/b)) + 2*b*d*x*sqrt(-a/b)/(2*a*b*d*sqrt(-a/b) + 2*b**2*d*s qrt(-a/b)), True))
Leaf count of result is larger than twice the leaf count of optimal. 215 vs. \(2 (38) = 76\).
Time = 0.15 (sec) , antiderivative size = 215, normalized size of antiderivative = 4.67 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=-\frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{4 \, \sqrt {a b} {\left (a + b\right )} d} + \frac {\arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{2 \, \sqrt {a b} d} + \frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{4 \, \sqrt {a b} {\left (a + b\right )} d} + \frac {\log \left ({\left (a + b\right )} e^{\left (4 \, d x + 4 \, c\right )} + 2 \, {\left (a - b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a + b\right )}{4 \, {\left (a + b\right )} d} - \frac {\log \left (2 \, {\left (a - b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + {\left (a + b\right )} e^{\left (-4 \, d x - 4 \, c\right )} + a + b\right )}{4 \, {\left (a + b\right )} d} \] Input:
integrate(tanh(d*x+c)^2/(a+b*tanh(d*x+c)^2),x, algorithm="maxima")
Output:
-1/4*(a - b)*arctan(1/2*((a + b)*e^(2*d*x + 2*c) + a - b)/sqrt(a*b))/(sqrt (a*b)*(a + b)*d) + 1/2*arctan(1/2*((a + b)*e^(-2*d*x - 2*c) + a - b)/sqrt( a*b))/(sqrt(a*b)*d) + 1/4*(a - b)*arctan(1/2*((a + b)*e^(-2*d*x - 2*c) + a - b)/sqrt(a*b))/(sqrt(a*b)*(a + b)*d) + 1/4*log((a + b)*e^(4*d*x + 4*c) + 2*(a - b)*e^(2*d*x + 2*c) + a + b)/((a + b)*d) - 1/4*log(2*(a - b)*e^(-2* d*x - 2*c) + (a + b)*e^(-4*d*x - 4*c) + a + b)/((a + b)*d)
Time = 0.15 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.41 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=-\frac {\frac {a \arctan \left (\frac {a e^{\left (2 \, d x + 2 \, c\right )} + b e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{\sqrt {a b} {\left (a + b\right )}} - \frac {d x + c}{a + b}}{d} \] Input:
integrate(tanh(d*x+c)^2/(a+b*tanh(d*x+c)^2),x, algorithm="giac")
Output:
-(a*arctan(1/2*(a*e^(2*d*x + 2*c) + b*e^(2*d*x + 2*c) + a - b)/sqrt(a*b))/ (sqrt(a*b)*(a + b)) - (d*x + c)/(a + b))/d
Time = 0.11 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.83 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {x}{a+b}-\frac {a\,\mathrm {atan}\left (\frac {b\,\mathrm {tanh}\left (c+d\,x\right )}{\sqrt {a\,b}}\right )}{d\,\sqrt {a\,b}\,\left (a+b\right )} \] Input:
int(tanh(c + d*x)^2/(a + b*tanh(c + d*x)^2),x)
Output:
x/(a + b) - (a*atan((b*tanh(c + d*x))/(a*b)^(1/2)))/(d*(a*b)^(1/2)*(a + b) )
Time = 0.22 (sec) , antiderivative size = 40, normalized size of antiderivative = 0.87 \[ \int \frac {\tanh ^2(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {-\sqrt {b}\, \sqrt {a}\, \mathit {atan} \left (\frac {\tanh \left (d x +c \right ) b}{\sqrt {b}\, \sqrt {a}}\right )+b d x}{b d \left (a +b \right )} \] Input:
int(tanh(d*x+c)^2/(a+b*tanh(d*x+c)^2),x)
Output:
( - sqrt(b)*sqrt(a)*atan((tanh(c + d*x)*b)/(sqrt(b)*sqrt(a))) + b*d*x)/(b* d*(a + b))