Sunday, May 12, 2024

HP 71B: Basic RPN Program

HP 71B: Basic RPN Program



Repost


This is a repost of a basic program for the HP 71B. I received an email from Kenneth who pointed out that line 145 lead to an error. In further testing, this lead to the input routine not working correctly. The following code in today’s repost is a corrected algorithm. Edited lines are in blue (lines 5, 125, and 145).


The original entry, posted on August 29, 2016, will be deactivated.


HP 71B Program: BASIC


The program RPNBASIC puts the HP 71B into RPN mode with arithmetic functions, power, square root, and π.  The program contains room for one independent memory and a four level stack that works like the classic Hewlett Packard RPN calculators. 


I have the array S set up for six slots:

Slot 1: X stack (display)

Slot 2: Y stack

Slot 3: Z stack

Slot 4: T stack

Slot 5: Independent memory stack

Slot 6: (temporary memory)


For an idea of how RPN works, check out this tutorial:  http://edspi31415.blogspot.com/2011/09/rpn-basics.html


As a note, this program requires you to press the equals key [ = ] before you enter a number to the stack.  


Example:   2 + 3 + 9 = 14

Keys:

[ = ], 2, [END LINE]

[ = ], 3, [END LINE], [ + ], 

[ = ], 9,  [END LINE], [ + ]



The keys available during RPNBASIC:

[ = ] Input 

[ + ] Add: Y + X

[ - ] Subtract: Y - X

[ * ] Multiplication: Y * X 

[ / ] Divide: Y/X

[ g ] [ / ] (^) Exponent: Y^X

[ Q ]  Square Root √X

[ P ] Enter π to the stack 

[ M ] Store X in independent memory

[ R ] Recall memory 

[ C ] Clear X stack to 0


Stack operations:

[ S ] Swap with X and Y

[ D ] Roll stack down, result { Y, T, Z, X }


Exit the program: press [ E ]



HP 71B Program: RPNBASIC  (828 bytes)

5 ! SIMPLE RPN, EWS 5/12/2024

10 DESTROY S, K$

15 DIM K$, S(6)

20 OPTION BASE 1

25 DISP "RPN BASIC" @ WAIT 1

30 DELAY 0,0

35 DISP S(1)

40 K$=KEY$

50 IF K$="+" THEN S(6)=S(1)+S(2) @ GOTO 100

52 IF K$="-" THEN S(6)=S(2)-S(1) @ GOTO 100

54 IF K$="*" THEN S(6)=S(1)*S(2) @ GOTO 100

56 IF K$="/" THEN S(6)=S(2)/S(1) @ GOTO 100

58 IF K$="=" THEN 140

60 IF K$="M" THEN S(5)=S(1) @ GOTO 35

62 IF K$="R" THEN S(6)=S(5) @ GOTO 120

64 IF K$="P" THEN S(6)=PI @ GOTO 120

66 IF K$="C" THEN S(1)=0 @ GOTO 35

68 IF K$="S" THEN 160

70 IF K$="D" THEN 180

72 IF K$="Q" THEN S(1)=SQR(S(1)) @ GOTO 35

74 IF K$="^" THEN S(6)=S(2)^S(1) @ GOTO 100

76 IF K$="E" THEN 200 ELSE 40

100 ! 2 STACK OPERATION

105 S(1)=S(6) @ S(2)=S(3) @ S(3)=S(4)

110 GOTO 35

120 ! PI/RCL/INPUT

125 S(4)=S(3) @ S(3)=S(2) @ S(2)=S(1) @ S(1)=S(6)

130 GOTO 35

140 ! INPUT NUMBER

145 INPUT "NUMBER:";S(6)

150 GOTO 120

160 ! SWAP 

165 S(6)=S(1) @ S(1)=S(2) @ S(2)=S(6)

170 GOTO 35

180 ! ROLL

185 S(6)=S(1)

190 S(1)=S(2) @ S(2)=S(3) @ S(3)=S(4) @ S(4)=S(6)

195 GOTO 35

200 STOP


Examples:


Remember the order of operations! 


Example 1:

22.5 - 12.3 * 3.3 = -18.09

[ = ], 12.3, [ END LINE ],

[ = ], 3.3, [ END LINE ], [ * ],

[ = ] 22.5, [ END LINE ], [ S ], [ - ]


Example 2: (5^2 + 1.4^3)/2 = 13.872

[ = ], 5, [ END LINE ], [ = ], 2, [ END LINE ], [ g ], [ / ] (^)

[ = ], 1.4, [ END LINE ], [ = ], 3, [ END LINE ], [ g ], [ / ] (^), [ + ]

[ = ], 2, [ END LINE ], [ / ]


Example 3: π * 3.12^2 + (3.12 * 1.99) = 36.7903195271

Store 3.12 in memory. 

[ = ], 3.12, [ END LINE ], [ M ],

[ = ], 2 , [ END LINE ], [ g ], [ / ] (^),

[ P ], [ * ],

[ R ], [ = ], 1.99, [ END LINE ], [ * ], [ + ] 


Enjoy!


Note: this program can be expanded to include additional functions and calculations.  



All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 



Saturday, May 11, 2024

Spotlight: Sharp EL-T100A

 Spotlight: Sharp EL-T100A




Quick Facts



Model: EL-T100A

Company: Sharp

Timeline: Late 2010s? (guess)

Type: Desktop, Quiz (Trainer)

Power: Solar, Battery back up CR2032






I purchased this EL-T100 at an estate sale in Glendora, California, for a dollar (along with paper). The EL-100T (and the later EL-100TA) is a “Brain Exerciser”, which is designed to test speed and accuracy on arithmetic math problems.


There are three modes for the EL-100A:


Regular desktop calculator. The display has 10 digits and has the arithmetic operator indicators. We can set and store the sales tax to use in future calculations. The keys are fast and responsive.


Quiz mode: Pressing the [ Quiz ] button to choose from a set of 25 problems, 50 problems, or 100 problems. We are given two results: the accuracy and the time it took to complete the quiz.


Age mode: Pressing the [ Age ] button will test you on 25 problems. In addition to accuracy time, your brain level is measured. After two attempts, which I took recently (March 24, 2024), I scored 98% correct in 1 minute, 26 seconds, with the age score of 42. The second time, I got 96% but in 1 minute, 17 seconds, with the age score of 40. I just turned 47 last March.


Key Summary


[ +TAX ] : Adds sales tax

Set tax rate: [ C CE ] [ C CE ] tax rate [ +TAX ]


[ -TAX ]: Subtracts sales tax

Verify tax rate: [ C CE ] [ C CE ] [ -TAX ]


[ R CM ]

Once: recalls the value in the memory register

Twice: clears the memory register (sets it as 0)


[ % ] {COR. %}

Math Mode: Perform a percentage calculation

Quiz/Age Mode: Verify the stored correct ratio of answers


[ × ] {DEL.}

Math Mode: multiplication

Quiz/Age Mode: erase stored, accumulated correct answers and percentage ratio


[ + ] {RES↑}

Math Mode: addition

Quiz/Age Mode: Display the completed duration values, oldest to newest problem


[ = ] {ENTER}

Math Mode: equals

Quiz/Age mode: start a drill or obtain an answer


[ - ] {RES↓}

Math Mode: subtraction

Quiz/Age Mode: Display the completed duration values, newest to oldest problem


[ ÷ ] {RANK}

Math Mode: division

Quiz/Age Mode: display the three fasted completed duration values of the quiz


[ CA ]

Clear all calculator memory except for tax rates. Terminates Quiz and Age mode.


[ M+ ]

Add the displayed value to the memory registers


Now I’m going to work on my fast arithmetic skills.


Source


“Sharp EL-T100AB” https://www.sharpusa.com/ForBusiness/SmallElectronics/CalculatorsNew/Models/ELT100AB.aspx Retrieved 29, 2024.


The Calculator Review “Review: Sharp EL-100AB “The Brian Exerciser”” February 27, 2019. https://www.calaquin.com/2019/02/review-sharp-el-t100ab-brain-exerciser.html Retrieved March 30, 2024.



Note: Both sources talk about an updated EL-T100AB, but it is said to share the same functionality of the EL-T100A.



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Sunday, May 5, 2024

Circular Sector: Finding the Radius and Angle

 Circular Sector: Finding the Radius and Angle





Here is the problem:


We are given the area of the circular segment, A, and the arc length of the segment, s. What is the radius, r, and the angle, θ?


The arc length is calculated as: s = θ * r


The area is calculated as: A = ½ * θ * r^2


We have the system of equations:


A = ½ * θ * r^2

s = θ * r


Divide A by s:


A / s= (½ * θ * r^2) / (θ * r)

A / s = r / 2

2 * A / s = r


Then

s = r * θ

θ = s / r = s^2 / (2 * A)


In summary:

r = 2 * A / s

θ = s / r = s^2 / (2 * A)


Note that the angle is in radians.

Example


Example 1:

s = 4, A = 30


r = (2 * 30) / 4 = 15

θ = 4 / 15 ≈ 0.266666667


Example 2:

s = 10.5, A = 31.8


r = (2 * 30) / 4 = 212/35 ≈ 6.057142857

θ = 10.5 / (212/35) = 735/424 ≈ 1.733490566


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, May 4, 2024

Battle of the “Cheap” Calculators: Sharp EL-501W vs. Bazic 3003

Battle of the “Cheap” Calculators: Sharp EL-501W vs. Bazic 3003


Let’s Get Ready to Rumble!”


Today is an accuracy battle between the:


Sharp EL-501W





This is brand name calculator. In the 2010s, Sharp manufactured one with blue casing. However, their current EL-501W type (really named the EL-501XBWH) has black casing. Both the EL-501W and EL-501XBWH have the same keyboard and the same amount of functions. The average price runs from $9 to $16 (US).





This is the Bazic 3003, a clone of the Sharp EL-501W/EL-501XBWH. This model sells in discount stores for anywhere from $3 to $6 (US).


There is another clone, the Jot Scientific Calculator which is physically smaller than both models I mentioned, and is even cheaper, close it $1 to $3. (US) I won’t be using this model in today’s tests.


The features on all these models include:


* trigonometric, hyperbolic, logarithm, and power functions

* binary, decimal, octal, and hexadecimal base conversions

* two buttons, [ a ] and [ b ] which assists with complex number arithmetic and polar/rectangular conversions

* random numbers

* one-variable statistics with basic analysis



The Exchange Function: { ↕ }


The exchange key switches the operands in arithmetic calculation. The key sequence is the same: [ 2ndF ] [ ( ] { ↕ }. If we complete an arithmetic calculation by pressing the equals button [ = ], the exchange function recalls the second operand for each operation. Well, almost.


Operation

Keystrokes

Result

Addition

A [ + ] B [ = ] [ 2ndF ] [ ( ] { ↕ }

B

Subtraction

A [ - ] B [ = ] [ 2ndF ] [ ( ] { ↕ }

B

Multiplication

A [ × ] B [ = ] [ 2ndF ] [ ( ] { ↕ }

A

Division

A [ ÷ ] B [ = ] [ 2ndF ] [ ( ] { ↕ }

B

Power

A [ y^x ] B [ = ] [ 2ndF ] [ ( ] { ↕ }

B

(A, B are two arbitrary numbers)



The Sharp EL-501W has plastic keys, a slide case, and takes two LR44 batteries, while the Bazic 3033 has rubber keys, a flip case, and takes two LR1130 batteries. As a personal preference, I prefer plastic keys to rubber keys.


Let’s compare.



A Comparison of Accuracy


The Trigonometric Forensics Evaluation


This test calculates:

arcsin( arccos( arctan( tan( cos( sin( 9° )))))) (six set of parenthesis)


However, we do not need parenthesis:

[ DRG ] (press until degrees mode is set)

9 [ SIN ] [ COS ] [ TAN ]

[ 2ndF ] [ TAN ] {TAN^-1} [ 2ndF ] [ COS ] {COS^-1} [ 2ndF ] [ SIN ] {SIN^-1}


Ideally, the answer returned should be exactly 9.





This test is presented on datamath.org web site (see source below), and this test was used to determine what chips were used in various Texas Instruments calculators.


Results:

Sharp EL-501W

8.9999 98637

Bazic 3003

8.9999 9986


Bazic gets the slight edge on this test.


The Cube of a Complex Number


The next test calculates (4.5 + 2.2i)^3.


The complex number mode only works for arithmetic functions (+, -, ×, ÷).


First, lets’ calculate the cube in complex mode.


Keystrokes:

[ 2ndF ] [ → ] {CPLX} (until CPLX indicator appears)

4.5 [ a ] 2.2 [ b ] [ × ] 4.5 [ a ] 2.2 [ b ] [ × ] 4.5 [ a ] 2.2 [ b ] [ = ]


Results:

Sharp EL-501W

25.785 + 123.002i (press [ b ] for the imaginary part)

Bazic 3003

25.785 + 123.002i (press [ b ] for the imaginary part)



Now in Real Mode using the polar/rectangular conversion functions.


Keystrokes:

[ 2ndF ] [ → ] {CPLX} (until CPLX indicator disappears)

4.5 [ a ] 2.2 [ b ] [ 2ndF ] [ a ] { →rθ }

[ b ] [ x→M/STO ] [ a ] [ y^x ] 3 [ = ] (manually record 125.6756071)

[ RM/RCL ] [ × ] 3 [ = ] [ b ] 125.6756071 [ a ] [ 2ndF ] [ b ] { →xy }


Results:

Sharp EL-501W

25.78499999 + 123.002i (press [ b ] for the yi part)

Bazic 3003

25.78499999 + 123.002i (press [ b ] for the yi part)



Test of the Logarithm Bug


This test to check to the accuracy of the approximation of e^x, where


e^x = lim n → ∞ (1 + x / n) ^n


If x = 1, then e = e^x = lim n → ∞ (1 + 1 / n) ^n


This test came about because there were several TI-30X and TI-36X calculators that were manufactured in the 1990s. See the Logarithm Bug in the Sources section for more details.


At various values of n:


(1 + 1 / N)^N

Sharp EL-501W

Bazic 3003

N = 10

2.59374246

2.59374246

N = 1,000

2.716923932

2.716923932

N = 100,000

2.718268237

2.718268237

N = 10,000,000 = 1E7

2.718281693

2.718281693


Both calculators give the same results. More importantly, there is no “logarithm bug” present from these results. Yay!



Statistics of Large Numbers


Sometimes when doing statistics of large numbers, which the numbers themselves differ by little, accuracy can suffer.


The data points for this sample:

100 008

100 014

100 007

100 016

100 009

100 006

100 010

100 015

100 012

100 018


Both calculators give these results:


Mean: 100011.5

Sum: 1000115

Sum^2: 1.0002E+11 (1.000230015E+11)

σx = 3.905124838

sx = 4.116363012

n = 10



Overall, the two calculators return the same result. Based off these results, it’s down to how much money you want to spend and what type of keys do you prefer.



Sources


Woerner, Joerg. “Calculator Integrated Circuits Forensics” Datamath.org. Last updated December 12, 2001

http://www.datamath.org/Forensics.htm. Retrieved March 16, 2024.



Senzer, Bob, Mike Sebastian, and Joerg Woerner. “Logarithm Bug” Datamath.org. Last updated October 11, 2005. http://www.datamath.org/Story/LogarithmBug.htm Retrieved March 16, 2024.


For the Star Wars fans, may the Fourth and Force be with you,


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Sunday, April 28, 2024

TI 30Xa Algorithms: Fundamental Horizontal Circle Calculations

 TI 30Xa Algorithms: Fundamental Horizontal Circle Calculations



Introduction and Formulas





Given the following:


r = radius of the curve

Δ = central angle, or the angular sweep of the curve. The angle is usually given in whole degrees or in surveying, degrees-minutes-seconds.


We can calculate the following:


The length of the tangent line to the central meeting point:

t = r × tan( Δ / 2 )


The linear distance from where the curve begins to the point the curve ends, known as the chord distance:

c = 2 × r × sin( Δ / 2 )


The distance of the curve from the end points, known as the arc length:

s = (Δ° / 180°) × π × r


Note the formula for arc length assumes that the angle is in degrees. If the angle is in radians, the formula for arc length reduces to s = Δ rad × r.



Procedure


The procedure is made for the TI-30Xa, where we can take advantage of the three memory registers it has. You can use another calculator, except most basic scientific calculators only have one memory register; you will just have type in one of the extra variables.


1. Check the angle mode. We should be in degrees mode, which is indicated by the DEG indicator. If not, press the [ DRG ] key until degrees mode is selected.


2. Enter the central degree (Δ).


If the degree is in whole degrees, just enter the angle and store into memory register 1. ( [ STO ] [ 1 ] ).


If the degree is in degrees-minutes-seconds format (known as DMS or sometimes as HMS), enter the angle in DD.MMSSS format. Then press [ 2nd ] [ + ] {DMS>DD} to convert the angle into whole degrees. Then store the result into memory register 1.


3. Enter the radius length and store in memory register 2. ( [ STO ] [ 2 ] ).


Memory registers:

M1 = Δ; M2 = r


4. Calculate the tangent length, t:


[ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ TAN ] [ × ] [ RCL ] 2 [ = ]


5. Calculate the chord distance, c:


2 [ × ] [ RCL ] 2 [ × ] [ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ SIN ] [ = ]


6. Calculate the arc length, s:


[ RCL ] 1 [ × ] [ π ] [ × ] [ RCL ] 2 [ ÷ ] 180 [ = ]


Examples


Let’s assume for the following examples Degrees mode is set (DEG).


Example 1:

r = 150 ft (it can be any length unit as long as you keep it consistent)

Δ = 60° (whole degrees)


60 [ STO ] 1

150 [ STO ] 2


t: [ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ TAN ] [ × ] [ RCL ] 2 [ = ]

t = 86.60254038 ft


c: 2 [ × ] [ RCL ] 2 [ × ] [ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ SIN ] [ = ]

c = 150 ft

(In this case, the chord length is the same as the radius. Why? There is a geometric reason.)


s: [ RCL ] 1 [ × ] [ π ] [ × ] [ RCL ] 2 [ ÷ ] 180 [ = ]

s = 157.0796327 ft



Example 2:

r = 324 ft

Δ = 92°22’18” (92 degrees, 22 minutes, 18 seconds)


92.2218 [ 2nd ] [ + ] {DMS>DD} [ STO ] 1

324 [ STO ] 2


t: [ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ TAN ] [ × ] [ RCL ] 2 [ = ]

t = 337.6968953 ft


c: 2 [ × ] [ RCL ] 2 [ × ] [ ( ] [ RCL ] 1 [ ÷ ] 2 [ ) ] [ SIN ] [ = ]

c = 467.5897175 ft


s: [ RCL ] 1 [ × ] [ π ] [ × ] [ RCL ] 2 [ ÷ ] 180 [ = ]

s = 522.3494689 ft



Source

Hewlett-Packard Company. HP-46 sample applications. Loveland, CO. February 1,1975. Part No. 00046-90018. pg. 104-105



Happy Birthday, Smokey!


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, April 27, 2024

Casio fx-CG 50: Points on a Circle

 Casio fx-CG 50: Points on a Circle


Introduction and Derivation





Given the initial point on a circle (x, y). If the point travels on a circle a distance of arc length s, where is the new point on the circle? Assumption: The center of the circle lies on the point (0, 0).


In fact, we can have two points depending on the direction traveled: counter-clockwise or clockwise. The programs presented today will determine both points.


Points that lie on the circle have the same radius. Determine the required radius:

r = √(x^2 + y^2)


And since the circle is centered at (0, 0), we can determine the angle by:

θ = arctan(y/x) = arg(x + yi)


We will assume all angles are in radians.


The arc length can be used to determine the angle traveled. Let’s call this angle z:

s = r × z

z = s / r


The new points can be determined by:


x’ = r × cos(θ + z), y’ = r × sin(θ + z)


x’’ = r × cos(θ - z), y’’ = r × sin(θ - z)


Casio fx-CG 50 Basic: PTSONCIRC


Code:


ClrText

Blue “POINTS ON”

Blue “THE CIRCLE”

Blue “CENTER (0,0)”

Red “RADIANS”

Rad

“INITIAL X”? → X

“INITIAL Y”? → Y

“ARC LENGTH”? → S

Abs (X+Yi) → R

Arg (X+Yi) → θ

S ÷ R → Z

R × cos(θ + Z) → A

R × sin(θ + Z) → B

R × cos(θ - Z) → C

R × cos(θ - Z) → D

ClrText

Green Locate 1,3,”POINT 1”

Black Locate 1,4,A

Blue Locate 11,4,”,”

Black Locate 12,4,B

Green Locate 1,5,”POINT 2”

Black Locate 1,6,C

Blue Locate 11,6,”,”

Black Locate 12,6,D


For monochrome models, leave out the color commands (Blue, Red, Black, Green)


Casio fx-CG 50 Python: ptsoncirc.py


Code:


from math import *

print(“Points on\nthe circle.”)

print(“Center is at (0,0)”)

x=float(input(“initial x? “))

y=float(input(“initial y? “))

s=float(input(“arc length? “))

r=sqrt(x**2+y**2)

t=atan(x,y)

z=s/r

b,a=r*cos(t+z),r*sin(t+z)

d,c=r*cos(t-z),r*sin(t-z)

print(“Point 1”)

print(str(a),”,\n”,str(b))

print(“Point 2”)

print(str(c),”,\n”,str(d))


Examples


X: 5, Y: 6, S: 1.5

Point 1: (3.76280901, 6.84406811)

Point 2: (6.05333094, 4.93529983)


X: 4: Y: 5, S: 1

Point 1: (3.173620164, 5.561306956)

Point 2: (4.729016994, 4.316989492)



Python Pointers


Storing to Multiple Variables in One Line


We can store a value to multiple variables in one line. For example,


a = b = 7

Stores the value 7 to both the variables a and b.


We can store multiple values to multiple values to multiple variables in one line. For example:


a, b = 7, 8

Stores 8 to the variable b and 7 to the variable a. The expression works from the inside-out.


We could also have both uppercase and lowercase letters as different variables, such as A and a. I choose not to because I want to avoid confusion.



New Line Escape Character: \n


In a string, we can add \n (backslash, n) to create a new line.



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


HP 71B: Basic RPN Program

HP 71B: Basic RPN Program Repost This is a repost of a basic program for the HP 71B. I received an email from Kenneth wh...