Status: New
Owner: ----
New issue 236 by
jbrezm...@gmail.com: nsum convergence criteria
http://code.google.com/p/mpmath/issues/detail?id=236
Hi,
I have tried to use nsum() for some cosine series, like: cos(nx)/(n^2)
however it doesn't work for x=pi*0.05. All methods produce wrong result
with fixed error.
The reason is wrong stopping criteria for direct summation method
(which is also used for all other methods). The direct method stops if
the last term after an update() is smaller then tolerance. In my case
in term for n=10 is cos(nx)=1e-17 and ever 20th term is nearly zero.
So if the method do not stop after the first 10 terms it will stop sooner
then desired.
extrapolation.py, function
adaptive_extrapolation
lines 507-509 in
https://github.com/sympy/sympy/blob/master/sympy/mpmath/calculus/extrapolation.py
# Check direct error
best = partial[-1]
error = abs(best - partial[-2])
The problem is that error is equal to absolute value of the last term only
which can be very close to zero.
Rather one should use something like:
error = abs(partial[-1] - partial[last_index])
where "last_index" is index before last update() call, similarly to the
error computed for extrapolation methods.
What version of the product are you using? On what operating system?
mpmath 0.17-1 on KUbuntu 12.04
Jan Brezina
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings