\(\int ((1-b^2 n^2) \text {sech}(a+b \log (c x^n))+2 b^2 n^2 \text {sech}^3(a+b \log (c x^n))) \, dx\) [186]

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

Optimal result

Integrand size = 44, antiderivative size = 40 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=x \text {sech}\left (a+b \log \left (c x^n\right )\right )+b n x \text {sech}\left (a+b \log \left (c x^n\right )\right ) \tanh \left (a+b \log \left (c x^n\right )\right ) \]

[Out]

x*sech(a+b*ln(c*x^n))+b*n*x*sech(a+b*ln(c*x^n))*tanh(a+b*ln(c*x^n))

Rubi [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.10 (sec) , antiderivative size = 139, normalized size of antiderivative = 3.48, number of steps used = 9, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {5664, 5666, 269, 371} \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\frac {16 e^{3 a} b^2 n^2 x \left (c x^n\right )^{3 b} \operatorname {Hypergeometric2F1}\left (3,\frac {3 b+\frac {1}{n}}{2 b},\frac {1}{2} \left (5+\frac {1}{b n}\right ),-e^{2 a} \left (c x^n\right )^{2 b}\right )}{3 b n+1}+2 e^a x (1-b n) \left (c x^n\right )^b \operatorname {Hypergeometric2F1}\left (1,\frac {b+\frac {1}{n}}{2 b},\frac {1}{2} \left (3+\frac {1}{b n}\right ),-e^{2 a} \left (c x^n\right )^{2 b}\right ) \]

[In]

Int[(1 - b^2*n^2)*Sech[a + b*Log[c*x^n]] + 2*b^2*n^2*Sech[a + b*Log[c*x^n]]^3,x]

[Out]

2*E^a*(1 - b*n)*x*(c*x^n)^b*Hypergeometric2F1[1, (b + n^(-1))/(2*b), (3 + 1/(b*n))/2, -(E^(2*a)*(c*x^n)^(2*b))
] + (16*b^2*E^(3*a)*n^2*x*(c*x^n)^(3*b)*Hypergeometric2F1[3, (3*b + n^(-1))/(2*b), (5 + 1/(b*n))/2, -(E^(2*a)*
(c*x^n)^(2*b))])/(1 + 3*b*n)

Rule 269

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Int[x^(m + n*p)*(b + a/x^n)^p, x] /; FreeQ[{a, b, m
, n}, x] && IntegerQ[p] && NegQ[n]

Rule 371

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*((c*x)^(m + 1)/(c*(m + 1)))*Hyperg
eometric2F1[-p, (m + 1)/n, (m + 1)/n + 1, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 5664

Int[Sech[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Dist[x/(n*(c*x^n)^(1/n)), Subst[Int[
x^(1/n - 1)*Sech[d*(a + b*Log[x])]^p, x], x, c*x^n], x] /; FreeQ[{a, b, c, d, n, p}, x] && (NeQ[c, 1] || NeQ[n
, 1])

Rule 5666

Int[((e_.)*(x_))^(m_.)*Sech[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Dist[2^p/E^(a*d*p), Int[(e*x)^m
*(1/(x^(b*d*p)*(1 + 1/(E^(2*a*d)*x^(2*b*d)))^p)), x], x] /; FreeQ[{a, b, d, e, m}, x] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \left (2 b^2 n^2\right ) \int \text {sech}^3\left (a+b \log \left (c x^n\right )\right ) \, dx+\left (1-b^2 n^2\right ) \int \text {sech}\left (a+b \log \left (c x^n\right )\right ) \, dx \\ & = \left (2 b^2 n x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int x^{-1+\frac {1}{n}} \text {sech}^3(a+b \log (x)) \, dx,x,c x^n\right )+\frac {\left (\left (1-b^2 n^2\right ) x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int x^{-1+\frac {1}{n}} \text {sech}(a+b \log (x)) \, dx,x,c x^n\right )}{n} \\ & = \left (16 b^2 e^{-3 a} n x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int \frac {x^{-1-3 b+\frac {1}{n}}}{\left (1+e^{-2 a} x^{-2 b}\right )^3} \, dx,x,c x^n\right )+\frac {\left (2 e^{-a} \left (1-b^2 n^2\right ) x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int \frac {x^{-1-b+\frac {1}{n}}}{1+e^{-2 a} x^{-2 b}} \, dx,x,c x^n\right )}{n} \\ & = \left (16 b^2 e^{-3 a} n x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int \frac {x^{-1+3 b+\frac {1}{n}}}{\left (e^{-2 a}+x^{2 b}\right )^3} \, dx,x,c x^n\right )+\frac {\left (2 e^{-a} \left (1-b^2 n^2\right ) x \left (c x^n\right )^{-1/n}\right ) \text {Subst}\left (\int \frac {x^{-1+b+\frac {1}{n}}}{e^{-2 a}+x^{2 b}} \, dx,x,c x^n\right )}{n} \\ & = 2 e^a (1-b n) x \left (c x^n\right )^b \operatorname {Hypergeometric2F1}\left (1,\frac {b+\frac {1}{n}}{2 b},\frac {1}{2} \left (3+\frac {1}{b n}\right ),-e^{2 a} \left (c x^n\right )^{2 b}\right )+\frac {16 b^2 e^{3 a} n^2 x \left (c x^n\right )^{3 b} \operatorname {Hypergeometric2F1}\left (3,\frac {3 b+\frac {1}{n}}{2 b},\frac {1}{2} \left (5+\frac {1}{b n}\right ),-e^{2 a} \left (c x^n\right )^{2 b}\right )}{1+3 b n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.72 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=x \text {sech}\left (a+b \log \left (c x^n\right )\right ) \left (1+b n \tanh \left (a+b \log \left (c x^n\right )\right )\right ) \]

[In]

Integrate[(1 - b^2*n^2)*Sech[a + b*Log[c*x^n]] + 2*b^2*n^2*Sech[a + b*Log[c*x^n]]^3,x]

[Out]

x*Sech[a + b*Log[c*x^n]]*(1 + b*n*Tanh[a + b*Log[c*x^n]])

Maple [A] (verified)

Time = 33.73 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.25

method result size
parallelrisch \(\frac {2 x \left (b n \sinh \left (a +b \ln \left (c \,x^{n}\right )\right )+\cosh \left (a +b \ln \left (c \,x^{n}\right )\right )\right )}{\cosh \left (4 b \ln \left (\sqrt {c \,x^{n}}\right )+2 a \right )+1}\) \(50\)
risch \(\frac {2 c^{b} \left (x^{n}\right )^{b} x \left (n b \left (x^{n}\right )^{2 b} c^{2 b} {\mathrm e}^{3 a} {\mathrm e}^{\frac {3 i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}} {\mathrm e}^{-\frac {3 i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )}{2}} {\mathrm e}^{-\frac {3 i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}} {\mathrm e}^{\frac {3 i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )}{2}}-{\mathrm e}^{a} {\mathrm e}^{\frac {i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}} {\mathrm e}^{-\frac {i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )}{2}} {\mathrm e}^{-\frac {i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}} {\mathrm e}^{\frac {i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )}{2}} b n +\left (x^{n}\right )^{2 b} c^{2 b} {\mathrm e}^{3 a} {\mathrm e}^{\frac {3 i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}} {\mathrm e}^{-\frac {3 i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )}{2}} {\mathrm e}^{-\frac {3 i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}} {\mathrm e}^{\frac {3 i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )}{2}}+{\mathrm e}^{a} {\mathrm e}^{\frac {i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}} {\mathrm e}^{-\frac {i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )}{2}} {\mathrm e}^{-\frac {i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}} {\mathrm e}^{\frac {i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )}{2}}\right )}{{\left (\left (x^{n}\right )^{2 b} c^{2 b} {\mathrm e}^{2 a} {\mathrm e}^{i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}} {\mathrm e}^{-i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )} {\mathrm e}^{-i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}} {\mathrm e}^{i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )}+1\right )}^{2}}\) \(509\)

[In]

int((-b^2*n^2+1)*sech(a+b*ln(c*x^n))+2*b^2*n^2*sech(a+b*ln(c*x^n))^3,x,method=_RETURNVERBOSE)

[Out]

2*x*(b*n*sinh(a+b*ln(c*x^n))+cosh(a+b*ln(c*x^n)))/(cosh(4*b*ln((c*x^n)^(1/2))+2*a)+1)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 189 vs. \(2 (40) = 80\).

Time = 0.25 (sec) , antiderivative size = 189, normalized size of antiderivative = 4.72 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\frac {2 \, {\left ({\left (b n + 1\right )} x \cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} + 2 \, {\left (b n + 1\right )} x \cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) \sinh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) + {\left (b n + 1\right )} x \sinh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} - {\left (b n - 1\right )} x\right )}}{\cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{3} + 3 \, \cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) \sinh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} + \sinh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{3} + {\left (3 \, \cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} + 1\right )} \sinh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) + 3 \, \cosh \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )} \]

[In]

integrate((-b^2*n^2+1)*sech(a+b*log(c*x^n))+2*b^2*n^2*sech(a+b*log(c*x^n))^3,x, algorithm="fricas")

[Out]

2*((b*n + 1)*x*cosh(b*n*log(x) + b*log(c) + a)^2 + 2*(b*n + 1)*x*cosh(b*n*log(x) + b*log(c) + a)*sinh(b*n*log(
x) + b*log(c) + a) + (b*n + 1)*x*sinh(b*n*log(x) + b*log(c) + a)^2 - (b*n - 1)*x)/(cosh(b*n*log(x) + b*log(c)
+ a)^3 + 3*cosh(b*n*log(x) + b*log(c) + a)*sinh(b*n*log(x) + b*log(c) + a)^2 + sinh(b*n*log(x) + b*log(c) + a)
^3 + (3*cosh(b*n*log(x) + b*log(c) + a)^2 + 1)*sinh(b*n*log(x) + b*log(c) + a) + 3*cosh(b*n*log(x) + b*log(c)
+ a))

Sympy [F]

\[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\int \left (2 b^{2} n^{2} \operatorname {sech}^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )} - b^{2} n^{2} + 1\right ) \operatorname {sech}{\left (a + b \log {\left (c x^{n} \right )} \right )}\, dx \]

[In]

integrate((-b**2*n**2+1)*sech(a+b*ln(c*x**n))+2*b**2*n**2*sech(a+b*ln(c*x**n))**3,x)

[Out]

Integral((2*b**2*n**2*sech(a + b*log(c*x**n))**2 - b**2*n**2 + 1)*sech(a + b*log(c*x**n)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 96 vs. \(2 (40) = 80\).

Time = 0.36 (sec) , antiderivative size = 96, normalized size of antiderivative = 2.40 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\frac {2 \, {\left ({\left (b c^{3 \, b} n + c^{3 \, b}\right )} x e^{\left (3 \, b \log \left (x^{n}\right ) + 3 \, a\right )} - {\left (b c^{b} n - c^{b}\right )} x e^{\left (b \log \left (x^{n}\right ) + a\right )}\right )}}{c^{4 \, b} e^{\left (4 \, b \log \left (x^{n}\right ) + 4 \, a\right )} + 2 \, c^{2 \, b} e^{\left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right )} + 1} \]

[In]

integrate((-b^2*n^2+1)*sech(a+b*log(c*x^n))+2*b^2*n^2*sech(a+b*log(c*x^n))^3,x, algorithm="maxima")

[Out]

2*((b*c^(3*b)*n + c^(3*b))*x*e^(3*b*log(x^n) + 3*a) - (b*c^b*n - c^b)*x*e^(b*log(x^n) + a))/(c^(4*b)*e^(4*b*lo
g(x^n) + 4*a) + 2*c^(2*b)*e^(2*b*log(x^n) + 2*a) + 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 215 vs. \(2 (40) = 80\).

Time = 0.76 (sec) , antiderivative size = 215, normalized size of antiderivative = 5.38 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\frac {2 \, b c^{3 \, b} n x x^{3 \, b n} e^{\left (3 \, a\right )}}{c^{4 \, b} x^{4 \, b n} e^{\left (4 \, a\right )} + 2 \, c^{2 \, b} x^{2 \, b n} e^{\left (2 \, a\right )} + 1} - \frac {2 \, b c^{b} n x x^{b n} e^{a}}{c^{4 \, b} x^{4 \, b n} e^{\left (4 \, a\right )} + 2 \, c^{2 \, b} x^{2 \, b n} e^{\left (2 \, a\right )} + 1} + \frac {2 \, c^{3 \, b} x x^{3 \, b n} e^{\left (3 \, a\right )}}{c^{4 \, b} x^{4 \, b n} e^{\left (4 \, a\right )} + 2 \, c^{2 \, b} x^{2 \, b n} e^{\left (2 \, a\right )} + 1} + \frac {2 \, c^{b} x x^{b n} e^{a}}{c^{4 \, b} x^{4 \, b n} e^{\left (4 \, a\right )} + 2 \, c^{2 \, b} x^{2 \, b n} e^{\left (2 \, a\right )} + 1} \]

[In]

integrate((-b^2*n^2+1)*sech(a+b*log(c*x^n))+2*b^2*n^2*sech(a+b*log(c*x^n))^3,x, algorithm="giac")

[Out]

2*b*c^(3*b)*n*x*x^(3*b*n)*e^(3*a)/(c^(4*b)*x^(4*b*n)*e^(4*a) + 2*c^(2*b)*x^(2*b*n)*e^(2*a) + 1) - 2*b*c^b*n*x*
x^(b*n)*e^a/(c^(4*b)*x^(4*b*n)*e^(4*a) + 2*c^(2*b)*x^(2*b*n)*e^(2*a) + 1) + 2*c^(3*b)*x*x^(3*b*n)*e^(3*a)/(c^(
4*b)*x^(4*b*n)*e^(4*a) + 2*c^(2*b)*x^(2*b*n)*e^(2*a) + 1) + 2*c^b*x*x^(b*n)*e^a/(c^(4*b)*x^(4*b*n)*e^(4*a) + 2
*c^(2*b)*x^(2*b*n)*e^(2*a) + 1)

Mupad [B] (verification not implemented)

Time = 2.17 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.65 \[ \int \left (\left (1-b^2 n^2\right ) \text {sech}\left (a+b \log \left (c x^n\right )\right )+2 b^2 n^2 \text {sech}^3\left (a+b \log \left (c x^n\right )\right )\right ) \, dx=\frac {2\,x\,{\mathrm {e}}^a\,{\left (c\,x^n\right )}^b\,\left ({\mathrm {e}}^{2\,a}\,{\left (c\,x^n\right )}^{2\,b}-b\,n+b\,n\,{\mathrm {e}}^{2\,a}\,{\left (c\,x^n\right )}^{2\,b}+1\right )}{{\left ({\mathrm {e}}^{2\,a}\,{\left (c\,x^n\right )}^{2\,b}+1\right )}^2} \]

[In]

int((2*b^2*n^2)/cosh(a + b*log(c*x^n))^3 - (b^2*n^2 - 1)/cosh(a + b*log(c*x^n)),x)

[Out]

(2*x*exp(a)*(c*x^n)^b*(exp(2*a)*(c*x^n)^(2*b) - b*n + b*n*exp(2*a)*(c*x^n)^(2*b) + 1))/(exp(2*a)*(c*x^n)^(2*b)
 + 1)^2