[HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
|
01-01-2024, 07:56 AM
(This post was last modified: 01-02-2024 05:04 AM by LdBeth.)
Post: #1
|
|||
|
|||
[HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
There are seven functions of the type % --> % provided, they are ERF
function, Q function, and their inverse implemented using numerical approximation methods. Internally they are all computed using extended float. ERF, IERF Implementation of error function and its inverse using method from Sergei Winitzki's paper. ERFIV Implementation of inverse error function using method from Mike Giles' paper. QNORM, IQNORM Implementation of Q function and its inverse using `ERF` and `IERF`. Note the `UPTN` function actually gives a more acurrate result for Q function, but the inverse Q function is much faster than computing the inverse of Q using numerical solver, while the accuracy of both methods are approximately the same. QBEST A slightly better Q function approximation from [Dao Ngoc Phong et al]. If you ask me the result is still not as good as `UPTN`. IQSML This function from Pingyi Fan's paper gives decent approximation to inverse Q function when the input is small enough, and can compute the inverse when `IQNORM` gives infinity error. Reference [Sergei Winitzki] A handy approximation for the error function and its inverse, February 6, 2008. [Dao Ngoc Phong, Nguyen Xuan Hoai, R.I. (Bob) McKay] Evolving the Best Known Approximation to the Q Function. [Mike Giles] Approximating the erfinv function. [Pingyi Fan] New inequalities of Mill's ratio and Its Application to The Inverse Q-function Approximation erflib.zip (Size: 64.55 KB / Downloads: 6) |
|||
01-01-2024, 08:09 PM
(This post was last modified: 01-01-2024 08:15 PM by Gil.)
Post: #2
|
|||
|
|||
RE: [HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
Where your programs can be downloaded or seen?
And do they accept complex numbers? |
|||
01-02-2024, 04:36 AM
Post: #3
|
|||
|
|||
RE: [HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
Quote:Where your programs can be downloaded or seen? Sorry I just figure out how to add attachment to the message. It is now added to the first message of the thread. Quote:And do they accept complex numbers? No since my intention was to implement fast Q function and its inverse for probability computation, the functions are not extended for complex numbers, and neither the methods I referenced are meant to be used for implement complex valued erf function. |
|||
01-02-2024, 12:41 PM
(This post was last modified: 01-02-2024 01:51 PM by Gil.)
Post: #4
|
|||
|
|||
RE: [HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
As many of these functions can be expressed in term of erf, erfc, that accept theorically a complex number as argument, it might be interesting to have an alternative way of computing them (with complex number) in the HP50G, just to compare the results with the ones calculated in my programs.
By the way, what do you find for inverse_ERFc(1.93206244519E-475)? The answer should be almost 33, and not infinity as ERFc(33) =1.93206244519E-475). Other question: inverse_erf(1E-9) =? The correct answer should be about 8.86226925455E-10 (by effective integral execution), and not 8.86622703261E-10 (by UTPN). |
|||
01-03-2024, 10:42 AM
Post: #5
|
|||
|
|||
RE: [HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
Quote:By the way, what do you find for I didn't implement erfc or its inverse function in the library so I have no result for comparison. But if you are interested in the correctness of your result, FriCAS gives Code:
And by comparing the result computed using higher precision (5000 digits), I think you can trust the above result up to the 7_7311393656 part. Quote:inverse_erf(1E-9) =? IERF gives undefined result error, ERFIV gives 8.86226869911E-10. I don't think FriCAS can do inverse ERF so I asked Wolfram, it says 8.8622692545275801388109740820522708507986498595507634336469 × 10^-10 (Wolfram computes the result in higher precision until the result converges, so I know all except the last digit can be trusted) Given that nothing outside extended real number computation been used, I think the ERFIV gives pretty decent approximation. |
|||
01-03-2024, 02:52 PM
(This post was last modified: 01-03-2024 04:07 PM by Gil.)
Post: #6
|
|||
|
|||
RE: [HP49/50g] ERF, ERF inverse, Q, Q inverse in SysRPL
Thanks for your reply.
I thought that your program calculated also erf, erfc and their inverse, as does my program, that calculates also the FRESNEL integrals F_C & F_S (normalized or not) for any real number (-infinity +infinity) & equally for "small" complex numbers z=a+b with b≠0 and abs(a) and abs(b) less or equal to 5. I was interested in your Fresnel Integrals results F_C & /F_S — normalized as in Wolfram or not normalized as in Wikipedia graph —, when dealing with very large numbers (1000, 1 milllion, 1e12, for instance), just to see their good accuracy and compare them with my own (good) results and the ones calculated in Wolfram. Regards, Gil |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)