RE: HP48-HP50G : Error functions ERF(z), FRESNEL integrals, PROBIT, etc.
|
11-15-2023, 12:08 AM
Post: #29
|
|||
|
|||
RE: RE: HP48-HP50G : Error functions ERF(x or z), ERFC (x or z) & iERF/iERFc —>x
It seems a general solver to get from erfc to its inverse is a bad idea.
erfc(-∞) = 2 erfc(-5) ≈ 2 erfc(0) = 1 erfc(+5) ≈ 0 erfc(+∞) = 0 The curve is very flat on both end, it is hard to get accurate inverse, without function's derivatives. f = a - erfc(x) = (a-1) + erf(x) f' = 2/sqrt(pi) * exp(-x*x) f''/f' = -2x Halley: x = x - f/(f' - (f''/f')*(f/2)) = x - f/(f' + x*f) Code: function ierfc_halley(a, verbal) Again, ierfc is only rely on accurate erfc, which we have. lua> x = 1e-9 lua> y = ierfc_halley(1-x) lua> y 8.862269003885489e-10 lua> ierfc(1-x) 8.862269003885489e-10 Perfect accuracy. Now continue from previously, to get ierf(x) lua> dydx = sqrt(pi)/2 * exp(y*y) lua> h = x - (x-1+1) lua> y + dydx * h 8.86226925452758e-10 lua> ierf(x) 8.862269254527581e-10 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 21 Guest(s)