Hello Lester,
Le 30/12/2021 à 08:59, Lester Anderson a écrit :
Hello Samuel,
Thanks for the solution. As pointed out it is best to show the
equation being assessed (from www.bernoulli.org
<http://www.bernoulli.org>). The one I looked at was the following:
Explicit_formula.PNG
Using nchoosek in the original code gives the same issue.
The inner sum over v is very prone to cumulative rounding errors:
The term v^n gets huge rapidly -- so is numerically truncated --,
while the (-1)^v term makes the sum alternate, which enhances residues...
that then mainly come from numerical truncations.
With n_max = 20, the maximum value of nchoosek(20,10)=184756
and is definitely not an issue. While even only 13^13
--> 13^13
ans =
3.029D+14
is already not far from 1/%eps.
The recurrent implementation proposed earlier and based on
Bₘ = -∑_k=0_→ m-1 (C_^k _m+1 ).B_k /(m+1)
\frac{-1}{m+1}{\sum _{{k=0}}^{{m-1}}{m+1 \choose k}B_k
has neither alternate terms nor huge power values that make a
direct computation numerically catastrophic.
Regards
Samuel
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users