# Infinite sum bug

Why:

Limit[Sum[Sqrt[-i^2 + n^2]/n^2, {i, 1, n}], n -> Infinity]
(* 0 *)


but:

Integrate[Sqrt[1 - x^2], {x, 0, 1}]
(* Pi/4 *)


The former is the Riemann sum of the latter. They should be equal.

(Version: 11.3)

• The limit expression you gave returns unevaluated in version 12.0 (Win10-64 desktop) and 13.0 (Linux cloud) Jan 18 at 2:12
• Please do not use the bugs tag for new questions; the tag can be added when the problem has been vetted by this community and the observed behavior is confirmed to be a bug. Jan 18 at 2:14
• The limit expression is wrong, should be Sum[Sqrt[1 - i^2/n^2]/n, {i, 1, Infinity}] Jan 18 at 7:10
• @UlrichNeumann: Isn't that equivalent?$$\frac{\sqrt{1 - i^2/n^2}}{n} = \frac{1}{n} \sqrt{\frac{n^2 - i^2}{n^2}} = \frac{1}{n^2} \sqrt{n^2 - i^2}$$ Jan 18 at 18:14
• @MichaelSeifert You're right, thanks! Jan 18 at 18:52

In 13.0.0 on Windows 10

AsymptoticSum[Sqrt[-i^2/n^2 + 1]/n, {i, 1, n}, n -> Infinity]


Pi/4

It should be noticed that

AsymptoticSum[Sqrt[-i^2 + n^2]/n^2, {i, 1, n}, n -> Infinity]


returns the input.

• Thank you very much for solving my question. Jan 19 at 2:20

Numerically solving,

Needs["NumericalCalculus"]

lim = NLimit[Sum[Sqrt[-i^2 + n^2]/n^2, {i, 1, n}], n -> Infinity,
WorkingPrecision -> 15]

(* 0.785398 *)

RootApproximant[lim/Pi]*Pi

(* π/4 *)

• Thank you very much for solving my question. Jan 19 at 2:21

Try midpoint discretization x=1/(2n)+i/n, i,1,n-1:

dx = 1/n;
Sqrt[1 - x^2] dx  /. x -> dx/2 + i dx // FullSimplify (*Sqrt[1 - (1 + 2 i)^2/(4 n^2)]/n*)


Unfortunately Mathematica can't solve the limit

Limit[Sum[Sqrt[1 - (1 + 2 i)^2/(4 n^2)]/n , {i,1, n - 1}], n -> Infinity]


but numerically evaluation gives expected result ~Pi/4

Table[{n,NSum[Sqrt[1 - (1 + 2 i)^2/(4 n^2)]/n, {i, 1, n -1}]}, {n, {10, 100,1000 , 10000}}]
(*{{10, 0.688228}, {100, 0.775482}, {1000,0.784401}, {10000, 0.785298}}*)


left riemann sum works too

Table[{n,NSum[Sqrt[1 - i^2/n^2]/n, {i, 0, n - 1}]},{n, {10, 100, 1000 ,10000}}]
(* {{10, 0.82613}, {100, 0.790104}, {1000, 0.785889}, {10000, 0.785448}}*)
`
• Thank you very much. Jan 19 at 2:22