Post Reply 
RE: HP48-HP50G : Error functions ERF(z), FRESNEL integrals, PROBIT, etc.
12-03-2023, 02:58 PM (This post was last modified: 12-06-2023 11:21 PM by Gil.)
Post: #37
RE: RE: HP48-HP50G : Error functions ERF(x or z), ERFC (x or z) & iERF/iERFc —>x
New version 8

- with improvements
- and inclusion of new other related functions.

1) Same input checking as in versions 6/7
+ other input checkings,insuring that we are well in presence of not to large arguments (for real, max (IxI) OK if <= 9; for complex z=a+ib, max (IaI) and max(IbI) OK if both <= 9);

1b) The above max number (argument) 9 can be changed in the help program called max.arg.

1c) The help programs are labelled/written with small letters. See also 1g.

1d) The names of the 3 help programs are: complex (to deal with complex numbers), max.arg (above mentioned) and euler (to deal with complex numbers, to try and get the most exact result, when exact result should be ± (1 0) or ± (0 1)).

1e) The help programs are internal programs.
They are not to be used manually, or changed,
with the exception or the help program max.arg (see 1b).

1f) Instances of results with help program euler, in exact or approximate mode, with a dot after the 2 in the first two example:
'e^(2.*i*pi)' euler —> 1., and not (1.,2.54352307471E-12)
'e^(1.5*i*pi)' euler (0.,-1.), and not (-3.08985769397E-12,-1.)
but 'e^(2.2*i*pi)' euler —> (.809016994372,.587785252296).

1g) The name of all the user fonctions are written with (some) capital letters.
See also 1c.

2) Improvements on output "outlook".

3) Inverse functions, named now INV¦ and INV¦c
(and no more iERF and iERFc , as small i has another meaning —> see 4) below).

4) Besides the 3 functions related to the error function:
- iERFc
- ERFi
- w.FADDEEVA-KRAMP,
inclusion now of the following 3 new functions:
- PROBIT
- ERFcx
- F_DAWSON

For definitions, see Wikipedia/French and Wolfram Alpha, or 10) for the codes.

5) Inverse_ERF(p), labelled now INV¦
Initial program will convert p (p>=0 or p<0) into IpI.
IF p-1+1=p
Then Inverse_ERF(p) = ERFc(1-p)
(we want to be sure that we don't lose digits by calculating 1-p;
see, for instance, the results for p=5.0000000005E-4:
by Wolfram Alpha —> 4.4311349177240266E-4
by integral as p-1+1≠p —> 4.43113491773E-4
by built-in UTPN (in HP48-50G), but not using Inverse_ERFc(1-p) —> 4.43113492614E-4
by Inverse_ERFc(1-p) —> 4.43113491729E-4)
Else use Solver with initial value of p with always the Integral calculation, that gives better results.
END
IF initially p was negative
Then result =: -result
Else result = last, positive result
END

6) Inverse_ERFc(p), called now INV¦c
IF p > 1
Then p:= 2-p
(we calculate initially for resulting positive x values)
Else p= initial value p
END
IF p now > 0.9065 (it's an approximate value)
Then Solver with always the Integral calculation, that gives better results
(example results for x =.9999:
by Wolfram Alpha: 8.8622692777289E-5
by integral: 8.86226927774E-5
by built-in UTPN in HP48-50G: 8.86226927139E-5)
Else use the built-in UTPN function in HP48-50G.
END
IF you proceded initially to the change of p into 2-p
Then final result = -result
Else final result = same, positive result
END

6b) ERF and ERFc
The programs take into account the fact that the integral calculation gives more accurate result when IxI<= 0.01 then making use of the built-in function UTPN.

7) Initially, all programs allowed ± infinity as argument, supposing that the imaginary part of the argument did not exist. Now, it's not any more the case, but the "infinity" tests still appear, though they are not any more used in the present program execution. That part regarding "infinity" argument should be carefully removed in a cleaner version (or, again, treated separately, taking into account the fact that the argument may be a complex number (a+ib) with a=±infinity and b≠ infinity, or a≠infinity and b= ± infinity, or both a=±infinity and b=±infinity).

8) As in previous versions, all functions take one single argument.

9) Now all functions admit as argument, besides a real number, a complex number in the form:
- (a b)
- 'a+ib'
- 'r*e^(i*theta)'
- 'r*EXP(i*theta)',
even INV¦ and INV¦c functions (programs).


Attached File(s)
.hp  ERROR_08inf_useless.HP (Size: 7.85 KB / Downloads: 3)
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 - 12-03-2023 02:58 PM



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