Post Reply 
Calculator benchmark
08-20-2021, 03:34 AM
Post: #41
RE: Calculator benchmark
I just tried this, I still have Shift Setup F2 for line I/O mode.. maybe the firmware version is different? I have 3.11.0202

(08-13-2021 02:16 PM)robve Wrote:  Just my 2c: the keystrokes for the Casio fx-cg50 aren't the same as Casio fx-9750GIII (I own the former, not the latter). There is no Shift Setup F2 to switch to line I/O mode (it selects COORD instead) and EXE works differently. Use Shift Prgm and keep the FN menu to enter Prgm symbols. AEXE inserts a newline/carriage return [NL] symbol for the next statement:
Find all posts by this user
Quote this message in a reply
08-20-2021, 02:49 PM (This post was last modified: 08-20-2021 05:56 PM by robve.)
Post: #42
RE: Calculator benchmark
(08-20-2021 03:34 AM)jhallen Wrote:  I just tried this, I still have Shift Setup F2 for line I/O mode.. maybe the firmware version is different? I have 3.11.0202

(08-13-2021 02:16 PM)robve Wrote:  Just my 2c: the keystrokes for the Casio fx-cg50 aren't the same as Casio fx-9750GIII (I own the former, not the latter). There is no Shift Setup F2 to switch to line I/O mode (it selects COORD instead) and EXE works differently. Use Shift Prgm and keep the FN menu to enter Prgm symbols. AEXE inserts a newline/carriage return [NL] symbol for the next statement:

I should have mentioned that I used the Program app (B from the menu) not the Run-Matrix mode. My mistake. I thought you used the Program app for the setup and execution, but that's not the case. Activating the Prgm function keys helps to reduce the number of keystrokes for the entire setup.

In the Program app:

Code:
F3 5 EXE                        New program name [Q]
Shift Prgm                      Activate Prgm FN keys
F3 F1 1 EXE EXIT                Enter: Lbl 1[NL]
F4 -> Alpha A EXE               Enter: ?->A[NL] (input A)
F4 -> Alpha B EXE               Enter: ?->B[NL] (input B)
Alpha A x^2 + Alpha A -
ln Alpha B F5                   Enter: A^2+A-ln B Triangle   (display first answer)
ln Alpha B x^2                  Enter: ln B^2   (display second answer)
F5                              Enter: Triangle
F3 F2 1                         Enter: Goto 1

Full setup with a new program: 39 keystrokes

EXIT EXIT EXE to exit the editor and run. When running the program, it appears that the input allows you to enter A, B, 2A, B/2 etc to reuse previous values, which reduces the number of keystrokes (my previous keystroke score is too high). I think it is 77 (it's tedious, need to double check).

Edit: I got hold of the Casio. The execution is 77 plus the 23 EXE (12+11 EXE since we don't need the last EXE) thet are necessary for the display progress. This brings the total to 39+3+77+12+11=142.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2021, 02:58 PM
Post: #43
RE: Calculator benchmark
(08-19-2021 11:31 PM)Valentin Albillo Wrote:  there's again a simple optimization that will reduce your 101 score by no less than 4 keystrokes, leaving the new score as 97 ! ...

I can do it in 90. I'm not at all familiar with the 15C, however, so I may have made a mistake.
The idea is to do as much as possible in the setup.
So,
A: calculates and shows the 2 numbers,
R/S: doubles REG 1 & A
B: halves REG 2 & A

setup: total 41
Code:
 (2)  g P/R
 (2)  f Clear PGM
 (4)    2 STOx 1
 (2)    GTO A
 (3)  f LBL B
 (4)    2 STO/ 2
 (3)  f LBL A
 (2)    RCL 1
 (1)    ENTER
 (2)  f X^2
 (1)    +
 (2)    RCL 2
 (2)  g LN
 (1)    -
 (2)  f PSE
 (2)  g LSTX
 (1)    ENTER
 (1)    +
 (2) g P/R
 (2) f USER

calc: total 49 (last two entries are calculated in reverse order)
Code:
(13)  3.12 STO 1 2.56 STO 2 A
( 1)  B
( 1)  B
( 1)  R/S
( 1)  R/S
( 2)  R/S B
( 1)  B
( 7)  1.32 STO 2 A
( 8)  18.59 STO 1 A
( 8)  17.63 STO 1 A
( 5)  4 STOx 2 A
( 1)  B
Total: 90

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
08-20-2021, 06:12 PM
Post: #44
RE: Calculator benchmark
(08-20-2021 03:34 AM)jhallen Wrote:  I just tried this, I still have Shift Setup F2 for line I/O mode.. maybe the firmware version is different? I have 3.11.0202

I thought of a neat trick to get two outputs at the same time on the Casio by displaying the X,Y pair as a complex number. Entering 3.12[EXE] and 2.56[EXE] displays:

11.91439274
+1.880014517i


This avoids the extra EXE to display both results, thus saving 12 EXE keystrokes. The program is 2 keystrokes longer to enter i with Shift 0 (note: + replaces the triangle):

Code:
F3 5 EXE                        New program name [Q]
Shift Prgm                      Activate Prgm FN keys
F3 F1 1 EXE EXIT                Enter: Lbl 1[NL]
F4 -> Alpha A EXE               Enter: ?->A[NL] (input A)
F4 -> Alpha B EXE               Enter: ?->B[NL] (input B)
Alpha A x^2 + Alpha A -
ln Alpha B +                    Enter: A^2+A-ln B+
Shift 0 ln Alpha B x^2          Enter: i ln B^2
F5                              Enter: Triangle
F3 F2 1                         Enter: Goto 1

setup: 41
run: 3 (EXIT EXIT EXE to run)
execution: 88 (since 77 + 11 EXE)
total: 132

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2021, 08:26 PM (This post was last modified: 08-20-2021 08:30 PM by jhallen.)
Post: #45
RE: Calculator benchmark
(08-20-2021 06:12 PM)robve Wrote:  I thought of a neat trick to get two outputs at the same time on the Casio by displaying the X,Y pair as a complex number.

I just used this trick for the TI-30X Pro / TI-36X Pro. I had to "fix" the results to 5 digits because otherwise complex numbers go off the edge of the display (so you could scroll it, but lots of extra keystrokes). I have an old TI-68 that I think this will work for also.

But really Casio should add a way to print without waiting, and more intelligent prompting... I have the feeling that their recent development focus, at least on these calculators, has not been on programming.

I'm curious about fx-GC500, and have one on order. I watched a video suggesting that it is now the best calculator for EEs because its Laplace transform capability is built-in (unlike TI-nSpire CAS) and matches the way it's taught (uses s and t, unlike HP-Prime which uses x).
Find all posts by this user
Quote this message in a reply
08-22-2021, 10:29 AM (This post was last modified: 08-22-2021 06:31 PM by C.Ret.)
Post: #46
RE: Calculator benchmark
(08-19-2021 11:31 PM)Valentin Albillo Wrote:  See if you can find it (I'm sure you will).

Yes, but too late, I found same ways to spare a few strokes but not the 4 strokes you were waiting for !

Werner propose a much economic solution, but I think we reach a limit in clarity. Especially when he changes the order of results not following at the original table order.

I try to optimize a bit more his code trying to include all the process into a unique code run. But I am not satisfy with the solution I come to. It is far too much confusing and the user certainly will be completely lost.

That why I was looking for a much more secure way to do this job

Quote: I think this is a fairly representative calculator problem- perhaps you have collected some data from an experiment, and need to transform this data before presenting it.

Imagine you have to present the results to your boss or an examination committee; any confusing results, mistake or erroneous transcription would certainly bring you in big troubles !

Fortunately, I found a device that will be a easy and secure to use:

HP-19C PROGRAM
Code:
(3)    [.PRGM.]  f Clear PRGM
(27)   2.56  STO 2  3.12  GSB 0  GSB 2  GSB 2  GSB 1  GSB 1  STO*1  GSB 2  GSB 2                             # Main program: build up table
(29)   g 1/x  ST+2  GSB 2  18.56  GSB 0  17.63  GSB 0  g 1/x  GSB 2  g 1/x  GTO 2                            

(6)    g LBL 0  STO 1  1                                                                                     # Subprograms
(7)    g LBL 1  STO*1  1                                                                                     ;  0:sto A   1:sto 2A  2:sto B/2
(6)    g LBL 2  STO/2
(30)   g LBL 9  RCL 1  STO 0  STO*0  STO+0  RCL 2  ENTER^  f LN  STO-0  ENTER^  +  RCL 0  f PRSTK  2  g RTN  ; Compute X and Y then print A B Y X 
(2)    [..RUN]  R/S                                                                                          # Switch back to RUN mode and run code

This PRINT the complete and unambiguous listing where labels X Y Z & T indicate respectively X Y B & A values:

R/S

3.1200 T
2.5600 Z
1.8800 Y
11.9144 X

3.1200 T
1.2800 Z
0.4937 Y
12.6075 X

3.1200 T
0.6400 Z
-0.8926 Y
13.3007 X

6.2400 T
0.6400 Z
-0.8926 Y
45.6239 X

12.4800 T
0.6400 Z
-0.8926 Y
168.6767 X

24.9600 T
0.3200 Z
-2.2789 Y
649.1010 X

24.9600 T
0.1600 Z
-3.6652 Y
649.7942 X

24.9600 T
1.3200 Z
0.5553 Y
647.6840 X

18.5600 T
1.3200 Z
0.5553 Y
362.7560 X

17.6300 T
1.3200 Z
0.5553 Y
328.1693 X

17.6300 T
2.6400 Z
1.9416 Y
327.4761 X

17.6300 T
5.2800 Z
3.3279 Y
326.7838 X


SCORE 110 for the honorable and practical HP-19C pocket printing calculator.
Find all posts by this user
Quote this message in a reply
08-22-2021, 06:42 PM
Post: #47
RE: Calculator benchmark
I've made an attempt on the NUMWORKS calculator. Score is not great, but it gives you an idea of using microPython. I don't have this calculator, but there is an Android app that emulates it.

https://github.com/jhallen/calculator/wiki/NUMWORKS
Find all posts by this user
Quote this message in a reply
08-23-2021, 10:51 PM
Post: #48
RE: Calculator benchmark
I came up with a slightly shorter 103 keystroke solution for the SHARP PC-E500, saving 10 keystrokes for the execution by extending the program, adding 7 keystrokes. The program assigns B/2 to C so that C can be entered as a shortcut for B/2.

I hesitated to post this, because the method is slightly less generic than the one posted before that had no assumptions whatsoever on the values entered during execution, which is really nice. The more a method deviates from generality by implementing specific shortcuts for this problem posted by the OP, the less useful the benchmark may become to estimate how well a calculator performs for this type of problem (i.e. not this specific problem).

Setup takes 38 keystrokes:
Code:
[BASIC]                                      1 enter PRO MODE
1I.A[ENTER]                                  5
2I.B:C=B/2[ENTER]                           12 set C to B/2 so C can be used for B/2 later
3P.[x^2]A+A-[LN]B,[LN][x^2]B:G.1[ENTER]     20

Execution takes 65 keystrokes:
Code:
[BASIC]          1 enter RUN mode
[F1][ENTER]      2 run
3.12[ENTER]      5
2.56[ENTER]      5 displays X and Y
[ENTER]          1 A is unchanged
C[ENTER]         2 C is B/2, displays X and Y
[ENTER]          1 A is unchanged
C[ENTER]         2 C is B/2, displays X and Y
2*A[ENTER]       4
[ENTER]          1 B is unchanged, displays X and Y
2*A[ENTER]       4
[ENTER]          1 B is unchanged, displays X and Y
2*A[ENTER]       4
C[ENTER]         2 C is B/2, displays X and Y
[ENTER]          1 A is unchanged
C[ENTER]         2 C is B/2, displays X and Y
[ENTER]          1 A is unchanged
C[ENTER]         2 C is B/2, displays X and Y
18.59[ENTER]     6
[ENTER]          1 B is unchanged, displays X and Y
17.63[ENTER]     6
[ENTER]          1 B is unchanged, displays X and Y
[ENTER]          1 A is unchanged
2*B[ENTER]       4 displays X and Y
[ENTER]          1 A is unchanged
2*B[ENTER]       4 displays X and Y

SHARP PC-E500 score: 103 keystrokes

SHARP PC-G850(V)(S) score: 104 keystrokes

The program and execution for the SHARP PC-G850(V)(S) is the same, but takes one more keystroke for R. (RUN) instead of F1.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
09-22-2021, 06:14 PM (This post was last modified: 09-23-2021 01:22 AM by robve.)
Post: #49
RE: Calculator benchmark
I just bought a used Sharp EL-5100S in excellent condition to play with while I'm out of town. The EL-5100 was first produced in 1979 (Eddie's blog post). The EL-5100 is the first calculator with algebraic entry and dot matrix display (virtual museum of calculators). It not only looks great, it is awesome to use too.

So the first thing I tried with my "new" machine is AER (Algebraic Expression Reserve) to store and run the benchmark formula.

Code:
AER-switch                   1 switch to AER mode
[2ndF][f()=]AB[2ndF][f()=]   6 enter formula LHS: f(AB)=
A[x^2]+A-[LN]B,[LN]B[x^2]   11 enter formula RHS: A^2+A-LN B, LN B^2

Setup: 18 keystrokes

This assumes the AER space was empty or can be typed over. To clear AER, press [2ndF][CA].

Code:
COMP-switch     1 switch to comp mode
COMP            1 activate AER formula
3.12[COMP]      5
2.56[COMP]      5 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
B/2[COMP]       4 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
B/2[COMP]       4 displays X
[COMP]          1 displays Y
2A[COMP]        3
[COMP]          1 B is unchanged displays X
[COMP]          1 displays Y
2A[COMP]        3
[COMP]          1 B unchanged displays X
[COMP]          1 displays Y
2A[COMP]        3
B/2[COMP]       4 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
B/2[COMP]       4 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
B/2[COMP]       4 displays X
[COMP]          1 displays Y
18.59[COMP]     6
[COMP]          1 B is unchanged, displays X
[COMP]          1 displays Y
17.63[COMP]     6
[COMP]          1 B is unchanged, displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
2B[COMP]        3 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
2B[COMP]        3 displays X
[COMP]          1 displays Y

Execution: 81 keystrokes

Sharp EL-5100(S): 99 keystrokes

The execution shows prompts for the A=? and B=? values. The results displayed are shown with ANS 1 and ANS 2. This makes it easy to keep track of the values entered and the results produced.

I haven't used any shortcuts for this specific benchmark in the setup, i.e. this result is representative of the general performance of this calculator for this type of problem, not for this specific benchmark.

Just my 2c: shortcuts in the setup, such as pre-defining specific "user" key sequences to shorten the execution produce results that are only specific for the specific sequence of values entered in this benchmark. Adding shortcuts reminds me of CPU benchmark cheating (google it), where the machine recognizes the benchmark application to activate shortcuts and specific optimizations that aren't generally applied to other applications.

EDIT: corrected typo in "Eddie's blog post".

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
09-25-2021, 01:25 AM (This post was last modified: 09-26-2021 06:36 PM by robve.)
Post: #50
RE: Calculator benchmark
(09-22-2021 06:14 PM)robve Wrote:  Sharp EL-5100(S): 99 keystrokes
I haven't used any shortcuts for this specific benchmark in the setup, i.e. this result is representative of the general performance of this calculator for this type of problem, not for this specific benchmark.

With a cheat, ahem, "performance shortcut" for this specific problem:

Sharp EL-5100(S): 93 keystrokes

I'll buy the first person who finds this keystroke sequence a beer. If no one found it in 7 days, then I'll report the solution next week anyway.

PS (edit): just 92 keystrokes is also possible. So I have to restate the challenge slightly: the first person who finds a keystroke sequence of 93 or less gets a beer.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
10-02-2021, 10:08 PM (This post was last modified: 05-07-2022 07:27 PM by robve.)
Post: #51
RE: Calculator benchmark
(09-25-2021 01:25 AM)robve Wrote:  Sharp EL-5100(S): 93 keystrokes

I'll buy the first person who finds this keystroke sequence a beer. If no one found it in 7 days, then I'll report the solution next week anyway.

Just 92 keystrokes is also possible. So I have to restate the challenge slightly: the first person who finds a keystroke sequence of 93 or less gets a beer.

Alas, no submitted solutions.

A solution with 91 keystrokes saves the value B/2 in M in the AER setup. Instead of typing B/2 in the execution, the RM key suffices to obtain B/2:

AER-switch                   1 AER mode
[2ndF][f()=]AB=              5 enter formula LHS
/2[=>M]                      3 save B/2 in M
A[x^2]+A-[LN]B,[LN]B[x^2]   11 enter formula RHS


Setup: 20 keystrokes.

Code:
COMP-switch     1 comp mode
COMP            1 activate AER formula
3.12[COMP]      5
2.56[COMP]      5 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
RM[COMP]        2 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
RM[COMP]        2 displays X
[COMP]          1 displays Y
2A[COMP]        3
[COMP]          1 B is unchanged displays X
[COMP]          1 displays Y
2A[COMP]        3
[COMP]          1 B unchanged displays X
[COMP]          1 displays Y
2A[COMP]        3
RM[COMP]        2 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
RM[COMP]        2 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
RM[COMP]        2 displays X
[COMP]          1 displays Y
18.59[COMP]     6
[COMP]          1 B is unchanged, displays X
[COMP]          1 displays Y
17.63[COMP]     6
[COMP]          1 B is unchanged, displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
2B[COMP]        3 displays X
[COMP]          1 displays Y
[COMP]          1 A is unchanged
2B[COMP]        3 displays X
[COMP]          1 displays Y

Execution: 71 keystrokes.

Sharp EL-5100(S): 91 keystrokes

The EL-5100(S) was the first calculator to introduce algebraic notation. The expression syntax is internally still handled by the traditional operand and operator stacks combined with an X register to hold the last result. This means that /2[=>M] is legal, because /2 takes the last value stored in register X then divides it by 2. In this case X holds the last value entered. Because an internal register X is used to hold the last value and the syntax of infix and postfix operators allows omitting the first operand, a slew of tricks and hacks is possible to reduce the size of AER formulas and, consequently, reduce keystrokes.

There appears to be no requirement to use a comma in an AER formula to chain multiple expressions, despite what the SHARP manual says. The comma produces a value, which is not always desirable. Omitting the comma in a formula simply continues executing the next expression in the AER formula. This is what you would normally expect a simple calculator to do. Perhaps SHARP didn't want to reveal that the implementation of algebraic expression evaluation is a simple "shunting yard" algorithm to parse expressions.

Below is a list of EL-5100(S) tricks and hacks. Most aren't documented by SHARP or posted elsewhere:
Code:
After STO ⇒M M+ the last value is still usable as an operand for the next
operator.  For example:
    1;A STO B +1 STO C                  saves A to B and B+1 to C

When using an infix or postfix operator (+ - × ÷ Yˣ ˣ√ ℙ ℂ STO →POL →REC ² ⁻¹ !
⇒M M+ M- →DEG →DMS) at the start of an expression, this operator uses the last
value calculated as its first operand.  For example:
    1;f(A)=+1 STO A ×2 STO B            takes A then saves A+1 to A and 2A to B

In fact, this method also works without a function, but a value must be
calculated first and displayed before pressing COMP.  For example:
    1;STO A

Open parenthesis '(' can be omitted when using ')' or '=' in an expression.  A
'=' closes all parentheses of an expression.  For example:
    1;f(A)=2A-1)²                       computes (2A-1)²
    1;f(A)=1+(2×(A-3=²                  computes (1+(2×(A-3)))²

All parentheses before STO ⇒M M+ , ◣ are automatically closed.  For example:
    1;f(A)=2×(A-1 STO B                 takes A then saves 2×(A-1) to B

A comma ',' can be omitted (display value) when the next expression starts with
an operand.  For example:
    1;A+1 STO A 2B STO B                saves A+1 to A and 2B to B

A f()= function can be defined within an AER entry to start of the next
expression.  For example:
    1;f(A)=²,f(A)=√A                    takes A, displays A², then takes A
                                        again, displays √A

A f()= function does not require the closing ')', a '=' suffices.  For example:
    1;f(AB=√(A²+B²                      computes hypotenuse of A,B

A value specified with COMP for f(A)= can also use some of the same tricks.
For example:
    1;2 STO B f(A)=
    COMP
    1;A=?
    enter ×2
    1;ANS 1= 4.

Implied multiplication when applied to parentheses like A(1+2) is not possible,
except when applying after the closing ')' for memory or π: For example:
    1;1+B)A                             computes A×(1+B)

Always use (-) for unary minus, otherwise - (minus) takes X as an operand.

Powers Yˣ do not accept negative Y, use ² and repeated multiplications or use
√A²YˣB to compute |A|YˣB.

To compute the absolute value |A|, use √A².

To compute trunc(A) integer part of A, use A+ᴱ10-ᴱ10

To compute round(A) for positive A, use A+.5+ᴱ10-ᴱ10

To compute frac(A), use A-(A+ᴱ10-ᴱ10)

In COMP mode, when the COMP key is mixed with other key presses (except memory
operations), COMP always reverts to 1;. Therefore, put repetitive calculations
preferably in 1;.

Some examples to demonstrate these hacks.

Simpson's rule of integration:
Code:
1;f(ABC)=0 STO I 1 STO J 2 STO H A STO E B-A)÷C STO D◣
2;EEE+2E²-E+2 STO F ×J+I STO I E+D STO E 6-H STO H STO J C-1 STO C◣
3;I-F)D÷3

where:

1; specifies integration range A to B in C parts, where C must be even
2; evaluates one step of the function
3; computes the final result

The function is specified in 2; up to STO F, with E as x.

Press 1; or COMP to specify A, B and C, then press 2; and repeat COMP until the
counter C value displayed is -1. Press 3; to obtain the integral value. To
restart, press 1;. The values of A and B are retained, but C must be specified.

Example to compute the integral of x^3+2x^2-x+2 for x=1..5 in 8 steps:
Press 1; then enter the value 1 for A, 5 for B and 8 for C:
1;A=1 COMP
1;B=5 COMP
1;C=8 COMP
1;ANS 1= 0.5
Press 2; then press COMP until -1 is displayed:
2;ANS 1= 7.
COMP
...
2;ANS 1=-1.
Press 3;
3;ANS 1= 234.6666667

erf() approximation with maximum relative error 0.00013 (note that (-) means unary minus):
Code:
1;f(A)=² STO B √B÷A×√(1-e((-)B×(4÷π+.147B)÷(1+.147B

Note: erf(0)=0 but AER produces an error because √B÷A is used to determine the
sign of A.

GCD(A,B):
Code:
1;A-(A÷B+ᴱ10-ᴱ10)B STO C B STO A C STO B

Press COMP until zero is displayed (or when an error occurred), then A holds
the GCD result. Negative A or B may produce a negative GCD in A. In that case
ignore the sign of A or correct it with √A².

Example:
5040 STO A
411 STO B
COMP
1;ANS 1= 108.
COMP
1;ANS 1= 87.
COMP
1;ANS 1= 21.
COMP
1;ANS 1= 3.
COMP
1;ANS 1= 0.
RCL A
3.

Rational approximation by continued fractions:
Code:
1;E+ᴱ10-ᴱ10 STO D E-D STO E BD+J STO F B STO J F STO B CD+I STO F C STO I F STO C B÷C STO D E⁻¹ STO E A-D◣
2;f(A)=1 STO B STO I 0 STO C STO J A STO E

Press 2; to enter a value
Press 1; to compute the first approximation D=B/C~A, displays the difference A-D
Press COMP to compute the next approximation D=B/C~A, displays the difference A-D
Repeat COMP until the difference (error) is sufficiently small or zero

Result: B is the numerator, C the denominator and D=B/C~A

Example:
Press 2; then enter π
2;A=π
COMP
Press 1;
1;ANS 1= 0.141592654
COMP
1;ANS 1=-0.001264489
RCL B
22.
RCL C
7.
COMP
1;ANS 1= 0.00008322
RCL B
333.
RCL C
106.
COMP
1;ANS 1= 0.00000267
RCL B
355.
RCL C
113.

This gives 355/133 as an approximation of π with 5 digits precision.

Complex arithmetic:
Code:
1;f(BJ)=A+B STO A,I+J STO I◣
2;f(BJ)=A STO HAB-IJ STO A,BI+HJ STO I◣
3;f(BJ)=²+B² STO GA STO HAB+IJ)/G STO A,BI-HJ)/G STO I

where

1; adds B+Ji to A+Ii
2; multiplies A+Ii by B+Ji
3; divides A+Ii by B+Ji

Example:
12.5 STO A              re of first argument
(-)7 STO I              im of first argument
2ndF-G
2;B=3                   re of second argument
2;J=2                   im of second argument
2;ANS 1= 51.5           re of the product
2;ANS 2= 4.             im of the product

t-test:
Code:
1;f(A)=F÷E-A)÷√((G-E×(F÷E)²)÷(E²-E

STAT mode to enter the data.

COMP mode then COMP to compute the t test statistic for a theoretical mean
value given as A.

Example:
STAT mode
72 DATA
67 DATA
69 DATA
85 DATA
91 DATA
68 DATA
77 DATA
74 DATA
70 DATA
82 DATA
COMP mode
COMP
1;A=70
1;ANS 1= 2.147

Numerical differentiation:
Code:
1;f(A)=√A²+ᴱ‐9)×ᴱ‐4 STO H A+H÷2 STO A 0 STO D◣
2;SIN A=÷H+D STO D A-H STO A (‐)H STO H D

where:

1; specifies the differentiation point
2; evaluates the function, which must be done twice

The function is specified in 2; up to = with A as x.

Press 1; or COMP to specify A then press 2; and COMP to obtain the
differential of the function at point A.

Example to compute derivative of SIN at π/3 which is COS(π/3)=0.5:
Press DRG until RAD annunciator lights up
Press 1; then enter π÷3 for A:
1;A=π÷3 COMP
1;ANS 1= 0
Press 2; then press COMP:
2;ANS 1= 8270.183412
COMP
2;ANS 1= 0.5

Sterling's Gamma approximation:
Code:
1;f(A)=√2π×AYˣ(A-.5)×e(1÷12A-A

These fun concoctions are mine, except the last one, which is based on the Gamma function shown in http://rskey.org/el5100

Edit: after posting I noticed that the HP forum "machinery" replaced the E exponent symbol U+1D53C with a question mark. Is this a bug? I replaced the double stroke E with the ᴱ symbol. Ugly, but close enough. Also clarified the floor/round tricks, added the f(A= hack and added a complex arithmetic example.

Edit 2: further reduced to 91 keystrokes by replacing )= requiring two keystrokes [2ndF][f()=] with just one keystroke = as a shortcut.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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