2 of 2
edited tags

Accuracy and WorkingPrecision

Observe that

(*Gauss Laguerre*)
myglxw[n_Integer] := Block[{
    x,
    xis = Cases[NSolve[LaguerreL[n, x] == 0], _?NumericQ, Infinity]
    },
   
   {xis, xis/(n + 1)^2/LaguerreL[n + 1, xis]^2}
   
   ];
   
myglxw2[n_Integer] := Block[{
    x,
    xis = 
     Cases[NSolve[LaguerreL[n, x] == 0, WorkingPrecision -> 30], _?
       NumericQ, Infinity]
    },
   
   {xis, xis/(n + 1)^2/LaguerreL[n + 1, xis]^2}
   
   ];



myglxw2[10] - myglxw[10] // Chop
myglxw2[15] - myglxw[15] // Chop
myglxw2[20] - myglxw[20] // Chop

There differences look "small" (negligible).

myglxw2[50] - myglxw[50] // Chop
myglxw2[100] - myglxw[100] // Chop

Some really big differences.

Question: When to know I "have" to increase WorkingPrecision?

I only notice this because something went seriously wrong at some stage during a long calculation.

Chen Stats Yu
  • 5k
  • 2
  • 24
  • 50