(HP15C)(HP67)(HP41C) Bernoulli Polynomials
|
08-29-2023, 05:47 PM
(This post was last modified: 08-29-2023 08:24 PM by Albert Chan.)
Post: #5
|
|||
|
|||
RE: (HP15C)(HP67)(HP41C) Bernoulli Polynomials
(08-29-2023 11:47 AM)Namir Wrote: When I saw the nested summation formula in Wikipedia, I decided that it would be an easier approach to code That's quite true. But noted that formula had huge cancellation issue with factor (x+k)^m, when x and/or m is big. For example, if m=6, n=m (for last sum), it may have huge cancellation errors. \(\displaystyle \frac{\Delta^6(x^6)}{7} = \frac{x^6-6\,(x\!+\!1)^6+15\,(x\!+\!2)^6-20\,(x\!+\!3)^6+15\,(x\!+\!4)^6-6\,(x\!+\!5)^6+(x\!+\!6)^6}{7} = \frac{720}{7} \) Example, tested on XCas 1.9.0, with 48 bits float: XCas> B(m,x) := sum(1/(n+1) * sum((-1)^k * comb(n,k) * (x+k)^m, k = 0 .. n), n = 0 .. m) XCas> float(B(16, pi)) → 1462871.932 /* reference */ XCas> B(16, float(pi)) → -423965.265625 /* massive cancellations */ XCas> B2(16, float(pi)) → 1462871.93177 /* falling factorial form more stable */ |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)