\(\int (a+x^2)^2 (x+\sqrt {a+x^2})^n \, dx\) [485]

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

Optimal result

Integrand size = 21, antiderivative size = 164 \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=-\frac {a^5 \left (x+\sqrt {a+x^2}\right )^{-5+n}}{32 (5-n)}-\frac {5 a^4 \left (x+\sqrt {a+x^2}\right )^{-3+n}}{32 (3-n)}-\frac {5 a^3 \left (x+\sqrt {a+x^2}\right )^{-1+n}}{16 (1-n)}+\frac {5 a^2 \left (x+\sqrt {a+x^2}\right )^{1+n}}{16 (1+n)}+\frac {5 a \left (x+\sqrt {a+x^2}\right )^{3+n}}{32 (3+n)}+\frac {\left (x+\sqrt {a+x^2}\right )^{5+n}}{32 (5+n)} \]

[Out]

-1/32*a^5*(x+(x^2+a)^(1/2))^(-5+n)/(5-n)-5/32*a^4*(x+(x^2+a)^(1/2))^(-3+n)/(3-n)-5/16*a^3*(x+(x^2+a)^(1/2))^(-
1+n)/(1-n)+5/16*a^2*(x+(x^2+a)^(1/2))^(1+n)/(1+n)+5/32*a*(x+(x^2+a)^(1/2))^(3+n)/(3+n)+1/32*(x+(x^2+a)^(1/2))^
(5+n)/(5+n)

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 164, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {2147, 276} \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=-\frac {a^5 \left (\sqrt {a+x^2}+x\right )^{n-5}}{32 (5-n)}-\frac {5 a^4 \left (\sqrt {a+x^2}+x\right )^{n-3}}{32 (3-n)}-\frac {5 a^3 \left (\sqrt {a+x^2}+x\right )^{n-1}}{16 (1-n)}+\frac {5 a^2 \left (\sqrt {a+x^2}+x\right )^{n+1}}{16 (n+1)}+\frac {5 a \left (\sqrt {a+x^2}+x\right )^{n+3}}{32 (n+3)}+\frac {\left (\sqrt {a+x^2}+x\right )^{n+5}}{32 (n+5)} \]

[In]

Int[(a + x^2)^2*(x + Sqrt[a + x^2])^n,x]

[Out]

-1/32*(a^5*(x + Sqrt[a + x^2])^(-5 + n))/(5 - n) - (5*a^4*(x + Sqrt[a + x^2])^(-3 + n))/(32*(3 - n)) - (5*a^3*
(x + Sqrt[a + x^2])^(-1 + n))/(16*(1 - n)) + (5*a^2*(x + Sqrt[a + x^2])^(1 + n))/(16*(1 + n)) + (5*a*(x + Sqrt
[a + x^2])^(3 + n))/(32*(3 + n)) + (x + Sqrt[a + x^2])^(5 + n)/(32*(5 + n))

Rule 276

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

Rule 2147

Int[((g_) + (i_.)*(x_)^2)^(m_.)*((d_.) + (e_.)*(x_) + (f_.)*Sqrt[(a_) + (c_.)*(x_)^2])^(n_.), x_Symbol] :> Dis
t[(1/(2^(2*m + 1)*e*f^(2*m)))*(i/c)^m, Subst[Int[x^n*((d^2 + a*f^2 - 2*d*x + x^2)^(2*m + 1)/(-d + x)^(2*(m + 1
))), x], x, d + e*x + f*Sqrt[a + c*x^2]], x] /; FreeQ[{a, c, d, e, f, g, i, n}, x] && EqQ[e^2 - c*f^2, 0] && E
qQ[c*g - a*i, 0] && IntegerQ[2*m] && (IntegerQ[m] || GtQ[i/c, 0])

Rubi steps \begin{align*} \text {integral}& = \frac {1}{32} \text {Subst}\left (\int x^{-6+n} \left (a+x^2\right )^5 \, dx,x,x+\sqrt {a+x^2}\right ) \\ & = \frac {1}{32} \text {Subst}\left (\int \left (a^5 x^{-6+n}+5 a^4 x^{-4+n}+10 a^3 x^{-2+n}+10 a^2 x^n+5 a x^{2+n}+x^{4+n}\right ) \, dx,x,x+\sqrt {a+x^2}\right ) \\ & = -\frac {a^5 \left (x+\sqrt {a+x^2}\right )^{-5+n}}{32 (5-n)}-\frac {5 a^4 \left (x+\sqrt {a+x^2}\right )^{-3+n}}{32 (3-n)}-\frac {5 a^3 \left (x+\sqrt {a+x^2}\right )^{-1+n}}{16 (1-n)}+\frac {5 a^2 \left (x+\sqrt {a+x^2}\right )^{1+n}}{16 (1+n)}+\frac {5 a \left (x+\sqrt {a+x^2}\right )^{3+n}}{32 (3+n)}+\frac {\left (x+\sqrt {a+x^2}\right )^{5+n}}{32 (5+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.40 (sec) , antiderivative size = 138, normalized size of antiderivative = 0.84 \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=\frac {1}{32} \left (x+\sqrt {a+x^2}\right )^{-5+n} \left (\frac {a^5}{-5+n}+\frac {5 a^4 \left (x+\sqrt {a+x^2}\right )^2}{-3+n}+\frac {10 a^3 \left (x+\sqrt {a+x^2}\right )^4}{-1+n}+\frac {10 a^2 \left (x+\sqrt {a+x^2}\right )^6}{1+n}+\frac {5 a \left (x+\sqrt {a+x^2}\right )^8}{3+n}+\frac {\left (x+\sqrt {a+x^2}\right )^{10}}{5+n}\right ) \]

[In]

Integrate[(a + x^2)^2*(x + Sqrt[a + x^2])^n,x]

[Out]

((x + Sqrt[a + x^2])^(-5 + n)*(a^5/(-5 + n) + (5*a^4*(x + Sqrt[a + x^2])^2)/(-3 + n) + (10*a^3*(x + Sqrt[a + x
^2])^4)/(-1 + n) + (10*a^2*(x + Sqrt[a + x^2])^6)/(1 + n) + (5*a*(x + Sqrt[a + x^2])^8)/(3 + n) + (x + Sqrt[a
+ x^2])^10/(5 + n)))/32

Maple [C] (verified)

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

Time = 0.96 (sec) , antiderivative size = 216, normalized size of antiderivative = 1.32

method result size
meijerg \(\frac {2^{n} x^{5+n} {}_{3}^{}{\moversetsp {}{\mundersetsp {}{F_{2}^{}}}}\left (-\frac {n}{2},-\frac {5}{2}-\frac {n}{2},\frac {1}{2}-\frac {n}{2};1-n ,-\frac {3}{2}-\frac {n}{2};-\frac {a}{x^{2}}\right )}{5+n}+\frac {2^{1+n} a \,x^{3+n} {}_{3}^{}{\moversetsp {}{\mundersetsp {}{F_{2}^{}}}}\left (-\frac {n}{2},-\frac {3}{2}-\frac {n}{2},\frac {1}{2}-\frac {n}{2};1-n ,-\frac {1}{2}-\frac {n}{2};-\frac {a}{x^{2}}\right )}{3+n}+\frac {a^{\frac {5}{2}+\frac {n}{2}} n \left (\frac {8 \sqrt {\pi }\, x^{1+n} a^{-\frac {1}{2}-\frac {n}{2}} \left (\frac {a n}{x^{2}}+n -1\right ) {\left (\sqrt {1+\frac {a}{x^{2}}}+1\right )}^{-1+n}}{\left (1+n \right ) n \left (-2+2 n \right )}+\frac {4 \sqrt {\pi }\, x^{1+n} a^{-\frac {1}{2}-\frac {n}{2}} \sqrt {1+\frac {a}{x^{2}}}\, {\left (\sqrt {1+\frac {a}{x^{2}}}+1\right )}^{-1+n}}{\left (1+n \right ) n}\right )}{4 \sqrt {\pi }}\) \(216\)

[In]

int((x^2+a)^2*(x+(x^2+a)^(1/2))^n,x,method=_RETURNVERBOSE)

[Out]

2^n/(5+n)*x^(5+n)*hypergeom([-1/2*n,-5/2-1/2*n,1/2-1/2*n],[1-n,-3/2-1/2*n],-a/x^2)+2^(1+n)*a/(3+n)*x^(3+n)*hyp
ergeom([-1/2*n,-3/2-1/2*n,1/2-1/2*n],[1-n,-1/2-1/2*n],-a/x^2)+1/4*a^(5/2+1/2*n)/Pi^(1/2)*n*(8*Pi^(1/2)/(1+n)/n
*x^(1+n)*a^(-1/2-1/2*n)*(a/x^2*n+n-1)/(-2+2*n)*((1+a/x^2)^(1/2)+1)^(-1+n)+4*Pi^(1/2)/(1+n)/n*x^(1+n)*a^(-1/2-1
/2*n)*(1+a/x^2)^(1/2)*((1+a/x^2)^(1/2)+1)^(-1+n))

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 158, normalized size of antiderivative = 0.96 \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=-\frac {{\left (5 \, {\left (n^{4} - 10 \, n^{2} + 9\right )} x^{5} + 10 \, {\left (a n^{4} - 16 \, a n^{2} + 15 \, a\right )} x^{3} + 5 \, {\left (a^{2} n^{4} - 22 \, a^{2} n^{2} + 45 \, a^{2}\right )} x - {\left (a^{2} n^{5} - 30 \, a^{2} n^{3} + {\left (n^{5} - 10 \, n^{3} + 9 \, n\right )} x^{4} + 149 \, a^{2} n + 2 \, {\left (a n^{5} - 20 \, a n^{3} + 19 \, a n\right )} x^{2}\right )} \sqrt {x^{2} + a}\right )} {\left (x + \sqrt {x^{2} + a}\right )}^{n}}{n^{6} - 35 \, n^{4} + 259 \, n^{2} - 225} \]

[In]

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

[Out]

-(5*(n^4 - 10*n^2 + 9)*x^5 + 10*(a*n^4 - 16*a*n^2 + 15*a)*x^3 + 5*(a^2*n^4 - 22*a^2*n^2 + 45*a^2)*x - (a^2*n^5
 - 30*a^2*n^3 + (n^5 - 10*n^3 + 9*n)*x^4 + 149*a^2*n + 2*(a*n^5 - 20*a*n^3 + 19*a*n)*x^2)*sqrt(x^2 + a))*(x +
sqrt(x^2 + a))^n/(n^6 - 35*n^4 + 259*n^2 - 225)

Sympy [F(-1)]

Timed out. \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=\text {Timed out} \]

[In]

integrate((x**2+a)**2*(x+(x**2+a)**(1/2))**n,x)

[Out]

Timed out

Maxima [F]

\[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=\int { {\left (x^{2} + a\right )}^{2} {\left (x + \sqrt {x^{2} + a}\right )}^{n} \,d x } \]

[In]

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

[Out]

integrate((x^2 + a)^2*(x + sqrt(x^2 + a))^n, x)

Giac [F]

\[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=\int { {\left (x^{2} + a\right )}^{2} {\left (x + \sqrt {x^{2} + a}\right )}^{n} \,d x } \]

[In]

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

[Out]

integrate((x^2 + a)^2*(x + sqrt(x^2 + a))^n, x)

Mupad [F(-1)]

Timed out. \[ \int \left (a+x^2\right )^2 \left (x+\sqrt {a+x^2}\right )^n \, dx=\int {\left (x^2+a\right )}^2\,{\left (x+\sqrt {x^2+a}\right )}^n \,d x \]

[In]

int((a + x^2)^2*(x + (a + x^2)^(1/2))^n,x)

[Out]

int((a + x^2)^2*(x + (a + x^2)^(1/2))^n, x)