# limit of sequence

given this sequence

i tried the following:

  s,n = var('s,n')
s = sum((3*n)/sqrt(2*n^4-k^2*n^2), k, 1, n)
s.limit(n=Infinity)


but i get:

3*limit(n*sum(1/sqrt(-k^2*n^2 + 2*n^4), k, 1, n), n, +Infinity)


which is not the result i want, this sequence either diverges or converges, so its either a number or infinity/-infinity, any ideas how to make this work properly? or can sagemath not handle this type of limits?

thank you

edit retag close merge delete

Sort by ยป oldest newest most voted

Consider first the sum alone, without taking a limit.

var('k,n')
E = (3*n)/sqrt(2*n^4 - k^2*n^2)
S = sum(E.canonicalize_radical(), k, 1, n)


The value of S is more or less an echo. In other words, sage has no idea (and no chance) to find a closed formula for the sum.

sage: S
3*sum(1/sqrt(-k^2 + 2*n^2), k, 1, n)


Taking the limit from such an expression produces an other echo.

sage: S.limit(n = oo)
3*limit(sum(1/sqrt(-k^2 + 2*n^2), k, 1, n), n, +Infinity)


In such cases, we can ask for numerical values for a "big $n$":

sage: n = 10**6; 3.0 * sum([ 1.0 / sqrt(2.*n^2 - k^2) for k in range(1, n + 1)])
2.35619492953245


For such numerical computations pari/gp does a better job, we have for instance

? \p 100
realprecision = 115 significant digits (100 digits displayed)
? n = 10^6; sum(k=1, n, 3 / sqrt(2*n^2 - k^2))
%2 = 2.356194929532423149025695836193084006094556217514368071115402460936426617919755947726804564160237427
? n = 10^8; sum(k=1, n, 3 / sqrt(2*n^2 - k^2))
%3 = 2.35619449458574323604876967144696073157514146025901053849933599052885950787940136378309129299648754


Mathematically we have a masked Riemann sum: $$3\lim_{n\to\infty}\sum_{1\le k\le n}\frac 1{\sqrt{2n^2-k^2}} = 3\lim_{n\to\infty}\frac 1n\sum_{1\le k\le n}\frac 1{\sqrt{2-(k/n)^2}} = 3\int_0^1\frac{dx}{2-x^2} = \frac{3\pi}4\ ,$$ and this involved integral can be easily done in sage:

sage: var('x');
sage: integral( 3 / sqrt(2 - x^2), x, 0, 1)
3/4*pi
sage: _.n()
2.35619449019234


Sage is stronger, when the typist acts both as a good mathematician and as a good programmer, and it was designed to work best in such a combination.

more

thank you!

( 2022-05-19 10:38:03 +0200 )edit

but shouldnt sagemath be able to figure out that its a riemann sum on its own?

( 2022-05-20 14:43:21 +0200 )edit