Post Reply 
RE: HP48-HP50G : Error functions ERF(z), FRESNEL integrals, PROBIT, etc.
11-14-2023, 01:35 PM (This post was last modified: 11-14-2023 01:51 PM by Gil.)
Post: #22
RE: RE: HP48-HP50G : Error functions ERF(x or z), ERFC (x or z) & iERF/iERFc —>x
Check the following:

ERF(+5.1) :.999999999999

ERF (+5.2'):1
(with the HP50G roundings; in fact,correct is exactly 0.99999999999980751)

'ERFc (up to now) : 0 (1-"1" above)
(in fact should be 1.9249061099972305*10^-13)

But of course iERFc(0) does not give the expected value of 5.2.

We have to try and get iERFc(ERFc(x)) = x (or a near value).

That was the point of Albert Chan to which I did not pay attention.

Finally, I changed the programs,
starting by calculating ERFc, then setting ERF=1-ERFc.

ERF
\\<< \"1 Arg
.real x or
.complex (a b)\" DROP ERFc NEG 1 +
\\>>

iERF
\\<< \"Only HP 50G

1 Arg
.a real
(not a complex !)\" DROP 1 - -2 / NOVAL \\-> p X
\\<<
\\<< p 0 .5 X UTPN -
\\>> 'X' 2 # 2F12Ch SYSEVAL \"x of Erf\" \\->TAG
\\>>
\\>>

ERFc
\\<< \"1 Arg
.real x or
.complex (a b)\" DROP DUP IM 0 ==
IF
THEN RE 0 .5 ROT UTPN 2 *
ELSE C\\->R \\-> x y
\\<< 0 .5 x UTPN 2 * 'e^-x^2/(2*\\pi*x)*(1-COS(2*x*y)+i*SIN(2*x*y))' \\->NUM '2/\\pi*e^-x^2' \\->NUM '\\GS(k=1,30,e^(-k^2/4)/(k^2+4*x^2)*(2*x*(1-COS(2*x*y)*COSH(k*y))+k*SIN(2*x*y)*SINH(k*y)+i*(2*x*SIN(2*x*y)*COSH(k*y)+k*COS(2​*x*y)*SINH(k*y))))' \\->NUM * + -
\\>>
END
\\>>

iERFc
\\<< \"Only HP 50G

1 Arg
.a real
(not a complex !)\" DROP 2 / NOVAL \\-> p X
\\<<
\\<< p 0 .5 X UTPN -
\\>> 'X' 2 # 2F12Ch SYSEVAL \"x of Erfc\" \\->TAG
\\>>
\\>>

MiERFc
\\<< \"1 Arg
.a real
(not a complex !)\" DROP 2 / \\-> p
\\<<
\\<< p 0 .5 X UTPN -
\\>> 'X' 2 ROOT \"x of Erfc\" \\->TAG 'X' PURGE
\\>>
\\>>

MiERF
\\<< \"1 Arg
.a real
(not a complex !)\" DROP 1 - -2 / \\-> p
\\<<
\\<< p 0 .5 X UTPN -
\\>> 'X' 2 ROOT \"x of Erf\" \\->TAG 'X' PURGE
\\>>
\\>>


Now, with the new version 2:
ERFc(5.2) :1.92490611E-13
and iERFc (+1.92490611E-13) : 5.2 (exactly).


Attached File(s)
.hp  ERROR_02.HP (Size: 1.43 KB / Downloads: 1)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RE: HP48-HP50G : Error functions ERF(x or z), ERFC (x or z) & iERF/iERFc —>x - Gil - 11-14-2023 01:35 PM



User(s) browsing this thread: 8 Guest(s)