HP Forums
(49g) (50g) STAT Inv as user key — Inv.UTPC, Inv.UTPF, Inv.UTPN, Inv.UTPT - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49g) (50g) STAT Inv as user key — Inv.UTPC, Inv.UTPF, Inv.UTPN, Inv.UTPT (/thread-16097.html)



(49g) (50g) STAT Inv as user key — Inv.UTPC, Inv.UTPF, Inv.UTPN, Inv.UTPT - Gil - 12-31-2020 11:10 AM

The HP49-50G calculators have no built-in inverse function of
UTPC, UTPF, UTPN, UTPTN.

It's sometimes handy to dispose of them instantaneously,
without having to write a "root-solver" from scratch.

Here are the "missing" build-in inverse functions accessible through key-user assigned letters C, F, N and T:
LS-User C (C for Chi);
LS-User F (C for Fisher);
LS-User N (C for Normal);
LS-User T (C for sTudent).

The arguments are basically in the same order as in the
original build-in functions UTPC, UTPF, UTPN, UTPTN,
with the exception always — of course — of the last argument, that should be the upper-tail probability (for the reverse function), and not the x.Value of the original function.

Note that the arguments can be entered in two ways:
- {a b u.PROB}, i. e. with { }, when a and b are new;
- or u.PROB only, directly in the stack, without any { }, when a and b repeat themselves.

Example for the Normal distribution:
1st calculation
Mean: 10
Variance: 5
Probability on the right: 2.5%
X.N?

How to procede:
{10 5 0.025}
LS-User N (N like Normal)

Solution in the stack:
{Mean: 10 Var: 5 u.PROB: 0.025}
14.3826...

2nd calculation
Now only the probability changes.
Mean, like before : 10
Variance, like before : 5
Probability on the right: 5%
X.N?

How to procede:
No need to enter the cumbersome
{10 5 0.05}.
Just put directly 0.05 in the stack, without { }, i. e. the changed, new probability.
LS-User N (N like Normal).

Solution in the stack:
{Mean: 10 Var: 5 u.PROB: 0.05}
13.6780...

Here below are the codes for the key-assignments keys.

For Chi:
\<< DUP TYPE 5 ==
IF
THEN OBJ\-> DROP 'u.PROB' STO 'lib' STO
ELSE 'u.PROB' STO
END lib "lib" \->TAG u.PROB "u.PROB" \->TAG 2 \->LIST
\<< lib x.C UTPC u.PROB -
\>> 'x.C' 2 ROOT "x.C" \->TAG
\>>
13.1 ASN (13 = line 1, column 3, for letter C of Chi)

For F:
\<< DUP TYPE 5 ==
IF
THEN OBJ\-> DROP 'u.PROB' STO 'lib2' STO 'lib1' STO
ELSE 'u.PROB' STO
END lib1 "lib1" \->TAG lib2 "lib2" \->TAG u.PROB "u.PROB" \->TAG 3 \->LIST
\<< lib1 lib2 x.F UTPF u.PROB -
\>> 'x.F' 2 ROOT "x.F" \->TAG
\>>
16.1 ASN (16 = line 1, column 6, for letter F of Fisher)

For N:
\<< DUP TYPE 5 ==
IF
THEN OBJ\-> DROP 'u.PROB' STO 'vv' STO '\Gm\Gm' STO
ELSE 'u.PROB' STO
END \Gm\Gm "\Gm\Gm" \->TAG vv "vv" \->TAG u.PROB "u.PROB" \->TAG 3 \->LIST
\<< \Gm\Gm vv x.N UTPN u.PROB -
\>> 'x.N' 2 ROOT "x.N" \->TAG
\>>
42.1 ASN (4 = line 4, column 2, for letter N of Normal)

For sTudent:
\<< DUP TYPE 5 ==
IF
THEN OBJ\-> DROP 'u.PROB' STO 'lib' STO
ELSE 'u.PROB' STO
END lib "lib" \->TAG u.PROB "u.PROB" \->TAG 2 \->LIST
\<< lib x.t UTPT u.PROB -
\>> 'x.t' 2 ROOT "x.t" \->TAG
\>>
64.1 ASN (64 = line 6, column 4, for letter T of sTudent).

That's it.

Regards,
Gil