Post Reply 
Sharp EL-5100 Instruction Manual - PDF, full text searchable
05-08-2022, 08:28 PM (This post was last modified: 12-27-2023 03:10 AM by robve.)
Post: #8
RE: Sharp EL-5100 Instruction Manual - PDF, full text searchable
Thank you for sharing the EL-5100 manual!

I recently acquired an EL-5100 to add to my collection. I also have an EL-5100(S). Both are very nice looking machines and interesting from a historical point of view:

"In 1979, the world's. first direct formula entry scientific line of calculators, the EL-5100 series, was introduced by Sharp. Models EL-5100 and EL-5101 are specifically designed to simplify computation in the areas of architecture, civil engineering, electricity, statistics, surveying and more. The unique rolling writer feature and playback in direct formula entry, add many advantages in solving complex formulas. Additionally, the dot matrix liquid crystal display provides alphanumeric readout." -- Sharp EL-5100/5101 Scientific Calculator Application Text.

"As a world first, Sharp introduced the EL-5100 scientific calculator in 1979, which was the first to include a dot matrix LCD display capable of displaying alphanumeric characters, and the first to be used with the now standard expression evaluation method: the algebraic expression keyed in will be calculated only after pressing the = key. In addition, the machine was programmable, as it was able to store such expressions in four programs (areas) and recalculate them with new and new values. The manufacturer called the new system AER which abbreviates Algebraic Expression Reserve. Later, several machines were built according to this system, and the AER itself was further developed and expanded with conditional branching, looping and subroutine handling capabilities, which are common in professional programmable calculators." Virtual Museum of Calculators

Hacking the EL-5100

I really enjoy using RPN machines as well as any machine that is programmable, even the esoteric vintage Sharp AER calculators such as the EL-5100 and EL-5200/EL-9000. After having used the EL-5100(S) for some time, it was surprising to me that there is a lot more the EL-5100 can do with some hacks than the manual and application text suggest!

To dig into this matter further, note that the EL-5100 manual on pages 9 to 11 illustrates how the EL-5100 evaluates expressions with an X register, a "data buffer" and a "function buffer". The fact that two stacks ("buffers") are used and the steps performed to evaluate expressions, clearly shows that the Sharp EL-5100 uses a simple implementation of the Shunting Yard algorithm. The Shunting Yard algorithm is a limited form of so-called operator-precedence parsing which itself is a limited form of LR parsing. The EL-5100 combines the Shunting Yard algorithm with a "last answer" register X by passing X as an operand to operators. Expressions that would normally be flagged as syntactically invalid by operator-precedence parsers can be evaluated on the EL-5100 in AER programs. This opens the door to hacking EL-5100 AER programs to do things that would not be easy or even possible if we stick to the manual.

AER on the EL-5100 lacks loops, conditionals and subroutine calls. AER is limited to expressions over global variables A to J and simple functions definitions. An expression can be up to 80 "steps" long. A step is essentially a unit of one byte or one character. Built-in functions, such as SIN, take one byte.

Conditional execution hacks

A zero power 0Yˣ0 returns 0 (mathematically it is undefined). This can be used to implement comparison operations:
  • Kronecker delta(i,j): 1-(I-J)²Yˣ0
  • A≠0 giving 1 as true and 0 as false: A²Yˣ0
  • A≠B giving 1 as true and 0 as false: (A-B)²Yˣ0
  • A<0 giving 1 as true and 0 as false: (√A²-A+10-10)Yˣ0
  • A<B giving 1 as true and 0 as false: (√(A-B)²-A+B+10-10)Yˣ0
Note 1: √A²-A may have a roundoff residual fraction \( \pm 10^{-11} \) which we remove with √A²+10-10 if it matters.
Note 2: Powers do not accept negative left operands. We can use squaring and repeated multiplications or √A²YˣB or A²Yˣ(B÷2) i.e. if B is even.

For example, using the 4th expression in the list above, we can assign the value of A to B if C<0 with: (A-B)×(√C²-C+10-10)Yˣ0+B STO B

Missing function hacks

The following functions are missing on the EL-5100 but can be implemented as follows by using the EL-5100's non-rounding to 10 digits:
  • absolute value |A|: √A²
  • signum(A): A÷(√A²+ᴱ‐99) or A÷√A² when A≠0
  • trunc(A): A+1+ᴱ10-1-ᴱ10
  • round(A): A+1.5+ᴱ10-1-ᴱ10
  • frac(A): A-(A+1+ᴱ10-1-ᴱ10)
  • modulo(A,B): A-(A÷B+1+ᴱ10-1-ᴱ10)B
Note: denotes the base-10 exponent (the EXP key).

AER programming hacks

This list is useful to significantly reduce AER code size and to avoid displaying intermediate results when a comma is used to separate expressions (later AER versions introduced a space operator for this reason.) The first two points in the list below are mentioned in the manual, but are included here since we use them a lot. All other points are not mentioned anywhere in the manual or anywhere online as I've searched extensively online for resources on the EL-5100(S):
  • Implicit multiplication has higher precedence than multiplication and division:
    Code:
        1÷2A                                same as 1÷(2A)
  • Function parenthesis are optional and implicit multiplication, squaring and reciprocal have higher precedence:
    Code:
        SIN A                               same as SIN(A)
        COS AB                              same as COS(A×B)
        COS A²                              same as COS(A²)
        TAN A⁻¹                             same as TAN(A⁻¹)
  • Implied multiplication when applied to parentheses like A(B+2) is not possible, except when applying to A to J or to π after a closing ')':
    Code:
        1;1+B)A                             computes A×(1+B)
  • after STO ⇒M M+ M- the last value is still usable as an operand for the next operator (passed via register X):
    Code:
        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 (via register X):
    Code:
        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:
    Code:
        1;STO A
  • Open parenthesis '(' can be omitted when using ')' or '=' in an expression. A '=' closes all open parentheses of an expression:
    Code:
        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+ M- , ◣ are automatically closed:
    Code:
        1;f(A)=2×(A-1 STO B                 takes A then saves 2×(A-1) to B
  • A comma ',' can be omitted (the comma displays the result) when the next expression starts with an operand:
    Code:
        1;A+1 STO A 2B STO B                saves A+1 to A and 2B to B
  • A f()= function in AER can be defined within an AER expression to start another f()= function with expression:
    Code:
        1;f(A)=²,f(A)=√A                    takes A, displays A², then takes A
                                            again, displays √A
  • A f()= function does not require the closing ')', the '=' suffices:
    Code:
        1;f(AB=√(A²+B²                      computes hypotenuse of A,B
                                            (shorter is A→POL B but changes J)
  • A value specified with COMP for f(A)= can also use some of the same tricks:
    Code:
        1;2 STO B f(A)=
        COMP
        1;A=?
        enter ×2
        1;ANS 1= 4.

A summary of EL-5100(S) functions and operators

Code:
Functions and prefix operators:
    SIN     COS     TAN                 trig
    SIN⁻¹   COS⁻¹   TAN⁻¹               inverse trig
    SINH    COSH    TANH                hyperbolic trig
    SINH⁻¹  COSH⁻¹  TANH⁻¹              inverse hyperbolic trig
    e       ₁₀                          natural and base-10 exponents
    LN      LOG                         natural and base-10 logarithm
    √       ³√                          square and cube root
    (‐)                                 unary minus

Postfix functions:
    →DEG    →DMS                        convert to degrees or D.MS
    ²       ⁻¹                          square and reciprocal
    !                                   factorial

Infix functions and operators:
    →POL    →REC                        polar and rectangular (also assigns J)
    ℂ       ℙ                           combinations and permutations
    Yˣ      ˣ√                          power and root
    ×       ÷                           multiply and divide
    +       -                           add and subtract

Constants:
    π

Variables:
    A to J

Storage:
    <expression> STO <variable>         store in <variable>
    <expression> ⇒M                     store in M
    <expression> M+                     add to M
    <expression> M-                     subtract from M

Instruction sequencing:
    <expression> , <expression>         in AER press COMP
    ◣                                   end of line, press 2ndF COMP

Function definition in AER mode:
    f(<variables>)=<expression>

Gotchas
  • always use the (‐) key for unary minus, otherwise - (minus) takes the current value of the last answer register X as the left operand to return X-expression
  • RM (recall memory) is not programmable in AER

New AER programs

Solve f(x)=0 for x with the bisection method

This program uses a conditional assignment E-A)×(√F²-F+10-10)Yˣ0+A STO A to assign E (x) to A (left bound of the domain when F<0 (f(x)<0) to bisect the domain while searching.

Code:
1;f(AB=B-A)÷2 STO H A+H STO E◣
2;EE-2 STO F H÷2 STO H E-A)×(√F²-F+10-10)Yˣ0+A STO A +H STO E F

where:
1; specifies domain brackets A to B
2; performs one bisection step to move x closer to the solution, displays f(x)

The function f(x) to solve for x is specified in 2; up to STO F, with E as x.

Press 1; or COMP to specify bounds A and B, then press 2; and repeat COMP until the value of f(x) displayed is zero or small enough. Press RCL E to display the root x.

If the value f(x) displayed grows instead of shrinks, then start over with switched bounds A and B. It is assumed that the bounds A and B satisfy f(A) ≤ 0 ≤ f(B).

If the values f(x) do not quickly converge to zero but rather converge to one of the bounds A or B, then the bounds A and B may not bracket the solution. For example, when f(x) slowly shrinks with E moving toward A, then press 1; to start over with a smaller bound A and set B=E (the current x).

Example to solve x^2-2=0:

Press 1; then enter 0 for A and 10 for B:
1;A=0 COMP
1;B=10 COMP
Press 2; then press COMP until f(x)=0 or a small f(x) is displayed:
2;ANS 1= 23.
COMP
2;ANS 1= 4.25
COMP
...
2;ANS 1= ‐4.ᴱ‐11

Press RCL E to obtain the solution x of f(x)=0:
1.414213558

Press 1; then enter ‐10 for A and 0 for B:
1;A=‐10 COMP
1;B=0 COMP

Press 2; then press COMP
2;ANS 1= 23.
COMP
2;ANS 1= 54.25
Because the value grows, we start over with A and B switched:
1;A=0
1;B=‐10
Press 2; then press COMP until f(x)=0 or a small f(x) is displayed:
2;ANS 1= 23.
COMP
2;ANS 1= 4.25
COMP
...
2;ANS 1= ‐4.ᴱ‐11

Press RCL E to obtain the solution x of f(x)=0:
‐1.414213558

A better algorithm for root search is the secant method:

Solve f(x)=0 for x with the secant method

Iterate until convergence \( x_{n+1}=x_n-f(x_n)\frac{x_n-x_{n-1}}{f(x_n)-f(x_{n-1})} \)

Code:
1;f(E=+ᴱ‐4 STO D STO G◣
2;EE-2 STO F E-(E-D)F÷(F-G) STO G E STO D G STO E F STO G

where:
1; specifies the starting point x as E
2; evaluates f(x) and performs one secant step to move x closer to the solution, displays f(x)

The function f(x) to solve for x is specified in 2; up to STO F, with E as x.

Press 1; or COMP to specify starting x as E then press 2; and repeat COMP until the value of f(x) displayed is zero or small enough. Press RCL E to display the root x.

Example to solve x^2-2=0:

Press 1; then enter 2 for E:
1;E=2 COMP
Press 2; then press COMP until f(x)=0 or a small f(x) is displayed:
2;ANS 1= 2.
COMP
2;ANS 1= ‐2
COMP
...
2;ANS 1= ‐8.9ᴱ‐10

Press RCL E to obtain the solution x of f(x)=0:
1.414213562

Press 1; then enter ‐2 for E:
1;E=‐2 COMP
Press 2; then press COMP
2;ANS 1= 2.
COMP
2;ANS 1= 1.999799998
COMP
...
2;ANS 1= 9.2ᴱ‐10

Press RCL E to obtain the solution x of f(x)=0:
‐1.414213562

Simpson's rule of integration

Simpson's method is listed in the manual, but is quite cumbersome to use compared to this one.

\( \int_a^b f(x)\,dx \approx \frac{h}{3}\left[ f(x_0) + 4\sum_{j=1}^{n/2} f(x_{2j-1}) + 2\sum_{j=1}^{n/2-1} f(x_{2j}) + f(x_n) \right] \)

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, 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;. In this case the values of A and B were retained, but C must be specified.

Example to estimate \( \int_1^5 x^3+2x^2-x+2\,dx \) 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

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 \( \frac{d\sin(x)}{dx}|_{x=\pi/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


Rational approximation by continued fractions

Code:
1;E+1+ᴱ10-1-ᴱ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 to convert to rational form
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

Example to convert \( \pi \approx 355/113 \):

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 (0.00000267 residual). Continue to obtain more accurate approximations.

GCD

The Euclidean method using modulo of A and B computed with A-(A÷B+ᴱ10-ᴱ10)B.

Code:
1;A-(A÷B+1+ᴱ10-1-ᴱ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.


Error function

An erf() approximation with maximum relative error 0.00013:

Code:
1;f(A)=² STO B √B÷A×√(1-e((-)B×(4÷π+.147B)÷(1+.147B

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

An erf() series approximation \( {\rm erf}(t)=2/\sqrt{\pi}(x-x^3/3+x^5/(5\times 2!)-x^7/(7\times 3!)+\cdots) \)

Code:
1;C+1 STO C (-)BA²÷C STO B ×C÷(2C-1 M+◣
2;f(A)=(-)2÷√π÷A STO B 0 STO C ⇒M

where:
1; computes the next term of the series, adding the term to M
2; sets the t parameter as A and initializes B, C and M

Press COMP to specify t as A, then press 2; and repeat COMP until the term becomes sufficiently small (e.g. use TAB to specify precision). Press RM at any time to view intermediate results and the final erf(t) result.

Note: erf(0) is 0 but we get an error

Example erf(2):

Press 2; then enter the value 2 for A:
2;A=2 COMP
Press 1; then press COMP until the term becomes sufficiently small:
1;ANS 1= 2.256758334
COMP
1;ANS 1=-3.009011112
COMP
1;ANS 1= 3.610813335
COMP
1;ANS 1=-3.438869843
COMP
1;ANS 1= 2.674676544
COMP
1;ANS 1=-1.750697374
COMP
1;ANS 1= 0.987572878
COMP
1;ANS 1=-0.489083711
COMP
1;ANS 1= 0.215772225
COMP
1;ANS 1=-0.08580416
COMP
1;ANS 1= 0.031052934
COMP
1;ANS 1=-0.010310065
COMP
1;ANS 1= 0.003161753
COMP
1;ANS 1=-0.000900784
COMP
1;ANS 1= 0.000239618
COMP
1;ANS 1=-0.000059776
COMP
1;ANS 1= 0.000014038
COMP
1;ANS 1=-0.000003114
RM
0.99532172
COMP
1;ANS 1= 0.000000655
RM
0.995322375
COMP
1;ANS 1=-0.000000131
RM
0.995322244
COMP
1;ANS 1= 0.000000025
COMP
2;ANS 1=-0.000000005
RM
0.995322264
COMP
1;ANS 1= 7.8492065557ᴱ-10
RM
0.995322265


Sterling's Gamma approximation

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

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


These examples I came up with hopefully illustrate how the EL-5100 can be a bit more appealing and competitive to use, despite its age dating from 1979. The AER examples can be a bit puzzling to follow: the EL-5100 AER notation looks algebraic, but it's more of a mix of algebraic and key-stroke programming. The intro part helps to explain what constructs I've used for these examples. I am sure many other simple algorithms can be implemented on the EL-5100 with some EL-5100 "hacking".

Edit: minor update to fix a typo and fix trunc(), round() and related functions and examples to handle values .1 to .9 that appear to be rounded when adding \( 10^{10} \) even though no other value ranges are rounded, e.g. 1.1+ᴱ10-ᴱ10 = 1 but .1+ᴱ10-ᴱ10 = .1. Also -.9 to -.1 has this problem. To fix trunc() to handle any value, including -.9 to -.1, we can use the much more elaborate formula (10A+ᴱ11)×.1-ᴱ10. A strange and charming quirk of the EL-5100.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Sharp EL-5100 Instruction Manual - PDF, full text searchable - robve - 05-08-2022 08:28 PM



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