\(\int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx\) [179]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F(-2)]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 17, antiderivative size = 87 \[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=-\frac {(a-b) \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a+b-b \tanh ^2(x)}}\right )}{2 \sqrt {b}}+\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \tanh (x)}{\sqrt {a+b-b \tanh ^2(x)}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b-b \tanh ^2(x)} \] Output:

-1/2*(a-b)*arctan(b^(1/2)*tanh(x)/(a+b-b*tanh(x)^2)^(1/2))/b^(1/2)+a^(1/2) 
*arctanh(a^(1/2)*tanh(x)/(a+b-b*tanh(x)^2)^(1/2))-1/2*tanh(x)*(a+b-b*tanh( 
x)^2)^(1/2)
 

Mathematica [A] (verified)

Time = 0.24 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.72 \[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=-\frac {\cosh (x) \sqrt {a+b \text {sech}^2(x)} \left (\sqrt {2} (a-b) \arctan \left (\frac {\sqrt {2} \sqrt {b} \sinh (x)}{\sqrt {a+2 b+a \cosh (2 x)}}\right )-2 \sqrt {2} \sqrt {a} \sqrt {b} \text {arctanh}\left (\frac {\sqrt {2} \sqrt {a} \sinh (x)}{\sqrt {a+2 b+a \cosh (2 x)}}\right )+\sqrt {b} \sqrt {a+2 b+a \cosh (2 x)} \text {sech}(x) \tanh (x)\right )}{2 \sqrt {b} \sqrt {a+2 b+a \cosh (2 x)}} \] Input:

Integrate[Sqrt[a + b*Sech[x]^2]*Tanh[x]^2,x]
 

Output:

-1/2*(Cosh[x]*Sqrt[a + b*Sech[x]^2]*(Sqrt[2]*(a - b)*ArcTan[(Sqrt[2]*Sqrt[ 
b]*Sinh[x])/Sqrt[a + 2*b + a*Cosh[2*x]]] - 2*Sqrt[2]*Sqrt[a]*Sqrt[b]*ArcTa 
nh[(Sqrt[2]*Sqrt[a]*Sinh[x])/Sqrt[a + 2*b + a*Cosh[2*x]]] + Sqrt[b]*Sqrt[a 
 + 2*b + a*Cosh[2*x]]*Sech[x]*Tanh[x]))/(Sqrt[b]*Sqrt[a + 2*b + a*Cosh[2*x 
]])
 

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.647, Rules used = {3042, 25, 4629, 25, 2075, 380, 398, 224, 216, 291, 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 \tanh ^2(x) \sqrt {a+b \text {sech}^2(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (i x)^2 \left (-\sqrt {a+b \sec (i x)^2}\right )dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \sqrt {b \sec (i x)^2+a} \tan (i x)^2dx\)

\(\Big \downarrow \) 4629

\(\displaystyle -\int -\frac {\tanh ^2(x) \sqrt {a+b \left (1-\tanh ^2(x)\right )}}{1-\tanh ^2(x)}d\tanh (x)\)

\(\Big \downarrow \) 25

\(\displaystyle \int \frac {\tanh ^2(x) \sqrt {a+b \left (1-\tanh ^2(x)\right )}}{1-\tanh ^2(x)}d\tanh (x)\)

\(\Big \downarrow \) 2075

\(\displaystyle \int \frac {\tanh ^2(x) \sqrt {a-b \tanh ^2(x)+b}}{1-\tanh ^2(x)}d\tanh (x)\)

\(\Big \downarrow \) 380

\(\displaystyle \frac {1}{2} \int \frac {(a-b) \tanh ^2(x)+a+b}{\left (1-\tanh ^2(x)\right ) \sqrt {-b \tanh ^2(x)+a+b}}d\tanh (x)-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

\(\Big \downarrow \) 398

\(\displaystyle \frac {1}{2} \left (2 a \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {-b \tanh ^2(x)+a+b}}d\tanh (x)-(a-b) \int \frac {1}{\sqrt {-b \tanh ^2(x)+a+b}}d\tanh (x)\right )-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

\(\Big \downarrow \) 224

\(\displaystyle \frac {1}{2} \left (2 a \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {-b \tanh ^2(x)+a+b}}d\tanh (x)-(a-b) \int \frac {1}{\frac {b \tanh ^2(x)}{-b \tanh ^2(x)+a+b}+1}d\frac {\tanh (x)}{\sqrt {-b \tanh ^2(x)+a+b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

\(\Big \downarrow \) 216

\(\displaystyle \frac {1}{2} \left (2 a \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {-b \tanh ^2(x)+a+b}}d\tanh (x)-\frac {(a-b) \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a-b \tanh ^2(x)+b}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

\(\Big \downarrow \) 291

\(\displaystyle \frac {1}{2} \left (2 a \int \frac {1}{1-\frac {a \tanh ^2(x)}{-b \tanh ^2(x)+a+b}}d\frac {\tanh (x)}{\sqrt {-b \tanh ^2(x)+a+b}}-\frac {(a-b) \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a-b \tanh ^2(x)+b}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {1}{2} \left (2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \tanh (x)}{\sqrt {a-b \tanh ^2(x)+b}}\right )-\frac {(a-b) \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a-b \tanh ^2(x)+b}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a-b \tanh ^2(x)+b}\)

Input:

Int[Sqrt[a + b*Sech[x]^2]*Tanh[x]^2,x]
 

Output:

(-(((a - b)*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a + b - b*Tanh[x]^2]])/Sqrt[b]) 
+ 2*Sqrt[a]*ArcTanh[(Sqrt[a]*Tanh[x])/Sqrt[a + b - b*Tanh[x]^2]])/2 - (Tan 
h[x]*Sqrt[a + b - b*Tanh[x]^2])/2
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

rule 219
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])
 

rule 224
Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], 
x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b}, x] &&  !GtQ[a, 0]
 

rule 291
Int[1/(Sqrt[(a_) + (b_.)*(x_)^2]*((c_) + (d_.)*(x_)^2)), x_Symbol] :> Subst 
[Int[1/(c - (b*c - a*d)*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b, c, 
d}, x] && NeQ[b*c - a*d, 0]
 

rule 380
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[e*(e*x)^(m - 1)*(a + b*x^2)^(p + 1)*((c + d*x^2)^q/(b* 
(m + 2*(p + q) + 1))), x] - Simp[e^2/(b*(m + 2*(p + q) + 1))   Int[(e*x)^(m 
 - 2)*(a + b*x^2)^p*(c + d*x^2)^(q - 1)*Simp[a*c*(m - 1) + (a*d*(m - 1) - 2 
*q*(b*c - a*d))*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c 
- a*d, 0] && GtQ[q, 0] && GtQ[m, 1] && IntBinomialQ[a, b, c, d, e, m, 2, p, 
 q, x]
 

rule 398
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*Sqrt[(c_) + (d_.)*(x_)^2]) 
, x_Symbol] :> Simp[f/b   Int[1/Sqrt[c + d*x^2], x], x] + Simp[(b*e - a*f)/ 
b   Int[1/((a + b*x^2)*Sqrt[c + d*x^2]), x], x] /; FreeQ[{a, b, c, d, e, f} 
, x]
 

rule 2075
Int[(u_)^(p_.)*(v_)^(q_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*Expa 
ndToSum[u, x]^p*ExpandToSum[v, x]^q, x] /; FreeQ[{e, m, p, q}, x] && Binomi 
alQ[{u, v}, x] && EqQ[BinomialDegree[u, x] - BinomialDegree[v, x], 0] &&  ! 
BinomialMatchQ[{u, v}, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4629
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*((d_.)*tan[(e_.) + (f 
_.)*(x_)])^(m_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Sim 
p[ff/f   Subst[Int[(d*ff*x)^m*((a + b*(1 + ff^2*x^2)^(n/2))^p/(1 + ff^2*x^2 
)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] && Inte 
gerQ[n/2] && (IntegerQ[m/2] || EqQ[n, 2])
 
Maple [F]

\[\int \sqrt {a +\operatorname {sech}\left (x \right )^{2} b}\, \tanh \left (x \right )^{2}d x\]

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 725 vs. \(2 (69) = 138\).

Time = 0.21 (sec) , antiderivative size = 4184, normalized size of antiderivative = 48.09 \[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\text {Too large to display} \] Input:

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

Output:

Too large to include
 

Sympy [F]

\[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\int \sqrt {a + b \operatorname {sech}^{2}{\left (x \right )}} \tanh ^{2}{\left (x \right )}\, dx \] Input:

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

Output:

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

Maxima [F]

\[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\int { \sqrt {b \operatorname {sech}\left (x\right )^{2} + a} \tanh \left (x\right )^{2} \,d x } \] Input:

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

Output:

integrate(sqrt(b*sech(x)^2 + a)*tanh(x)^2, x)
 

Giac [F(-2)]

Exception generated. \[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Error: Bad Argument Type
 

Mupad [F(-1)]

Timed out. \[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\int {\mathrm {tanh}\left (x\right )}^2\,\sqrt {a+\frac {b}{{\mathrm {cosh}\left (x\right )}^2}} \,d x \] Input:

int(tanh(x)^2*(a + b/cosh(x)^2)^(1/2),x)
 

Output:

int(tanh(x)^2*(a + b/cosh(x)^2)^(1/2), x)
 

Reduce [F]

\[ \int \sqrt {a+b \text {sech}^2(x)} \tanh ^2(x) \, dx=\int \sqrt {\mathrm {sech}\left (x \right )^{2} b +a}\, \tanh \left (x \right )^{2}d x \] Input:

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

Output:

int(sqrt(sech(x)**2*b + a)*tanh(x)**2,x)