(33S) Legendre Polynomials
|
05-18-2022, 08:34 PM
(This post was last modified: 05-18-2022 09:08 PM by Albert Chan.)
Post: #5
|
|||
|
|||
RE: (33S) Legendre Polynomials
(05-18-2022 02:59 AM)Eddie W. Shore Wrote: Legendre Polynomials I think Pn as polynomial of (x-1)/2, is meant for symbolic calculations. BTW, mpmath use this form: hyp2f1(-n, n+1, 1, (1-x)/2). For integer n, both forms are equivalent (hyp2f1 version can work with arbitrary n) Code: function hyp2f1(a,b,c,z) Numerical calculations with big n, coefs blow-up, with alternate signs, we have massive cancellations. Below example, terms grow as big as ±1E48, before tappering down, making sum garbage. P100(0.25) = 1 - 3787.5 + 3585578.90625 - 1508034728.3203125 + ... lua> P_bad(100, 0.25) 9.184297382421194e+031 Code: function P(n,x) -- legendre recurrence relation formula Reccurence relation formula is faster, and *much* more accurate. It may seems we have the same cancellation issues, but half the subtractions are really sums. The other half, most of subtractions does not suffer catastrophic cancellations. lua> P(100, 0.25) -- error = -2 ULP 0.07812465474298284 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(33S) Legendre Polynomials - Eddie W. Shore - 05-18-2022, 02:59 AM
RE: (33S) Legendre Polynomials - Thomas Klemm - 05-18-2022, 04:02 PM
RE: (33S) Legendre Polynomials - John Keith - 05-18-2022, 05:11 PM
RE: (33S) Legendre Polynomials - Albert Chan - 05-18-2022 08:34 PM
RE: (33S) Legendre Polynomials - Thomas Klemm - 05-18-2022, 07:34 PM
RE: (33S) Legendre Polynomials - Thomas Klemm - 05-18-2022, 11:13 PM
RE: (33S) Legendre Polynomials - Thomas Klemm - 05-20-2022, 04:10 PM
RE: (33S) Legendre Polynomials - Albert Chan - 05-20-2022, 05:51 PM
RE: (33S) Legendre Polynomials - Thomas Klemm - 05-20-2022, 08:08 PM
|
User(s) browsing this thread: 2 Guest(s)