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.


Sunday, April 21, 2024

Casio fx-CG50 and Swiss Micros DM32: HP 16C’s Bit Summation

 Casio fx-CG50 and Swiss Micros DM32: HP 16C’s Bit Summation



The HP 16C’s #B Function


The #B function is the HP 16C’s number of bits function and sums the bits that are “turned on”. To find #B, if needed, convert the number to its binary form (base 2). #B are the number of ones. Here, I am assuming the binary integers are unsigned.


For example: Calculate #B(49). Assuming 49 is in decimal base.


49_10 = 110001_2


Then #B(49) = 3



Casio fx-CG 50 Program: BITS


I thought the fx-CG 50 had functions to convert integers and logical functions, but I did not have find them. If anyone knows whether the fx-CG 50 has base conversions, please let me know. I know that earlier Casio graphing calculators had base conversions.


The binary integer form is stored in B, as long as the decimal integer is less than 2048. (2^11).


Size: 168 bytes


“DEC→BIN”

“D”? → N

N → M

0 → C

0 → B

Int (log N ÷ log 2) → L

For L → J To 0 Step -1

If M ≥ 2^J

Then

C + 1 → C

M – 2^J → M

B × 10 + 1 → B

Else

B × 10 → B

IfEnd

Next

ClrText

If N < 2049

Then

“BIN=”

B ◢

IfEnd

“#B=”

C


The hashtag character (#) is called from the CHAR menu.



Swiss Micros DM32 Program: BITS


Two labels are used:

LBL B: 68 bytes

LBL T: 92 bytes


The main program is LBL B. This should fit on the classic HP 32S/32SII calculators.


B01 LBL B

B02 CF 0

B03 SF 10

B04 “DEC NUMB”

B05 PSE

B06 INPUT N

B07 STO M

B08 Clx

B09 STO C

B10 RCL N

B11 LOG

B12 2

B13 LOG

B14 ÷

B15 IP

B16 1

B17 +

B18 STO L


T01 LBL T

T02 RCL M

T03 2

T04 RCL L

T05 1

T06 -

T07 y^x

T08 -

T09 x≥0?

T10 SF 0

T11 FS? 0

T12 LASTx

T13 FS? 0

T14 STO- M

T15 FS? 0

T16 1

T17 FS? 0

T18 STO+ C

T19 CF 0

T20 DSE L

T21 GTO T

T22 RCL N

T23 BIN

T24 STOP

T25 “BITS=”

T26 PSE

T27 CF 10

T28 DEC

T29 VIEW C

T30 GTO B


Examples


Decimal: 35, Binary: 100011, #B(35) = 3

Decimal: 36, Binary: 100100, #B(36) = 2

Decimal: 37, Binary: 100101, #B(37) = 3


Decimal: 50, Binary: 110010, #B(50) = 3

Decimal: 51, Binary: 110011, #B(51) = 4

Decimal: 52, Binary: 110100, #B(52) = 3



Sources


Hewlett-Packard. HP-16C Computer Scientists Owner’s Handbook. Hewlett-Packard Company. 1982. pg. 52



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 20, 2024

Sharp EL-9300 Programs

Sharp EL-9300 Programs


Today’s blog entry takes us to the 1992 Sharp’s EL-9300 graphing calculator. On January 10, 2022, I gave a review of this calculator:

https://edspi31415.blogspot.com/2022/01/retro-review-sharp-el-9300c.html



The programs should also work on the EL-9200. Spaces are added for readability.



Sharp EL-9300 Program: polygon2


The program polygon2 calculates four properties of regular polygons:

* The internal angle of the polygon

* The length of the polygon’s apothem

* The length of the polygon’s radius

* The area of the polygon


A regular polygon is a polygon whose sides all have equal length and all the internal angles are equal.


REAL Mode

Print “Set Degrees 1st”

Wait 1

Print “number of sides”

Input n

Print “side length”

Input x

angle = (n – 2) / n * 180

apothem = x / 2 * tan (angle / 2)

radius = x / (2 * cos (angle / 2) )

area = n * x * apothem / 2

ClrT

Print angle

Print apothem

Print radius

Print area



Note that the calculator must be set in Degrees mode prior to running this program. To set the degrees mode, press [ SET UP ], [ B ], [ 1 ]. Note that this won’t set the angle mode indicator in the program as the angle mode change takes place outside of the program script.


Examples


Inputs: n = 6, x = 8

Outputs:

angle = 120 (internal angle)

apothem = 6.92820323

radius = 8

area = 166.2768775



Inputs: n = 12, x = 1.5

Outputs:

area = 150

apothem = 2.799038106

radius = 2.897777479

area = 25.19134295



Sharp EL-9300 Program: agm


The program agm calculates the arithmetic-geometric mean between two numbers x and y.


(x + y) / 2

√(x * y)


The program also asks for the tolerance. If the tolerance is small, it means we are asking for better accuracy at the expense of additional calculations.


REAL Mode

ClrT

Print “arithmetic/”

Print “geometric mean”

Input x

Input y

Print “tol (10^-nn)”

Input tol

Label loop

a = (x + y) / 2

g = √(x * y)

x = a

y = g

If abs(a – g) >= tol Goto loop

ClrT

Print “results”

Print a

Print g

End


Examples


Inputs: x = 15, y = 70, tol = 10^-6

Outputs:

a = 37.28076573

g = 37.28076573


Inputs: x = 1649, y = 1248, tol = 1E-7

Outputs:

a = 1441.519759

g = 1441.519759


The EL-9300 is pretty quick.



Sharp EL-9300: quadratic


The program quadratic solves the quadratic equation:


a * x^2 + b * x + c = 0


where a, b, and c can be real or complex numbers.


COMPLEX Mode

ClrT

Print “ax^2+bx+c=0”

Print “complex numbers”

Input a

Input b

Input c

x = (-b + √(b^2 – 4 * a * c)) / (2 * a)

z = x - √(b^2 – 4 * a * c) / a

ClrT

Print “solutions=”

Print x

Print z

End


Examples


Inputs:

a = 4 + 3i, b = 2 – 5i, c = 3i

Solutions:

x = 0.346818295 – 0.288439118i

z = -0.066818295 + 1.328439118i


Inputs:

a = 2, b = -6i, c = -4 + 8i

Solutions:

x = 1.370730624 + 0.040924113i

z = -1.370730624 + 2.959075887i



Sharp EL-9300 Program: twobytwo


The program twobytwo solves the simultaneous set of equations:


a * x + b * y = e

c * x + d * y = f


where a, b, c, d, e, and f can be complex numbers.


COMPLEX Mode

Print “2x2 system”

Print “complex numbers”

Print “A=((a,b)(c,d))”

Input a

Input b

Input c

Input d

Print “B=((e)(f))”

Input e

Input f

g = a * d – b * c

h = e * d – f * b

i = a * f – c * e

x = h / g

y = i / g

ClrT

Print “solutions=”

Print x

Print y

End



Examples


Input:

a = 3 + 2i, b = -i

c = 3 – 2i, d = 1 – i

e = 0, f = 5i

Outputs:

x = -0.660377358 + 0.188679245i

y = -0.754716981 + 2.358490566i


Input:

a = 3, b = -6

c = 3i, d = 6i

e = 1, f = -i

Outputs:

x = 0

y = -0.166666667




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 14, 2024

Spotlight: Sharp EL-5200

 Spotlight: Sharp EL-5200


As we come on the 13th (April 16) anniversary of this blog, I want to thank you. Blogging about mathematics and calculators is a joy in my life and I’m grateful for your support.



Today’s spotlight is about an early graphing calculator, which is a rare collector’s item today: the Sharp EL-5200, also known as the Sharp EL-9000.








Quick Facts



Model: EL-5200/EL-9000

Company: Sharp

Timeline: 1986 – late 1980s

Type: Graphing, Programmable

Memory: 5,120 bytes

Power: 2 x CR2032 batteries



Keyboard


There are excellent reviews and articles on the Sharp EL-5200/EL-9000, please check out the Sources section below.

The EL-5200 is a folding calculator which is housed in a wallet. On the left side, we have the scientific keys, the arrow keys, memory keys, and the numeric keypad. The keys are the normal calculator keys.

On the right side, there are the alphabetic keys and the utility keys. I think the key style on the right side is a membrane keyboard, but I am not sure.



The Four Main Modes



The four main modes of the Sharp EL-5200 are, which are listed in switch order:

STAT mode

COMP mode

AER II mode

AER I mode



AER II and AER I modes are programming mode, which is called the Algebraic Expression Reserve mode. The AER I mode is the classic AER mode while AER II is the newer version of programming mode.



The manual to the EL-9000 can be downloaded here: http://basic.hopto.org/basic/manual/Sharp%20EL-9000%20EN.pdf



STAT Mode

This is the calculator's statistics mode. Upon switching to this mode, we have the option of storing data points. Data points are stored in array S while basic statistics are stored in array Z. The basic statistics stored in array Z are:



Z[1] = n

Z[2] = Σx

Z[3] = Σx^2

Z[4] = Σxy

Z[5] = Σy

Z[6] = Σy^2



Be aware when you decide to store data, it takes up programming memory.

Three keys are remapped as follows:

[ RM ]: CD. Clear data. Erases a data point.

[ ⇒M ] (x, y): Adds a comma between the x point and y point.

[ M+ ] DATA: Adds a data point.



The statistic variables are access through the second function ([2ndF]) of the numeric keypad and arithmetic keys.



Linear regression is offered in the form of y = a + bx. The variable a is the y-intercept while the variable b is the slope.



Adding × n before pressing [ M+ ] {DATA} adds the frequency to the data point.



Graphs of statistical data are available, including histograms, linear regression lines, and scatter plots.



Fairly simple.



COMP MODE



This is our calculation mode. In addition to our regular scientific calculator, which operates in algebraic mode, there are other sub-modes included in COMP Mode.



Graphing




We can graph up to two functions at one time. The [ RANGE ] key allows to set the range parameters, while the [ AUTO ] key sets the zoom level automatically. The [DRAW] key draws the graph.



For example, to draw y(x) = x^2 + 5 using automatic zoom, key in [ GRAPH ] [ X ] [ x^2 ] [ + ] 5 [ AUTO ] [ DRAW ].



The screen takes up the entire left hand of the screen. The screen shows one coordinate at a time, X or Y. Switch between the two with the key sequence [ 2ndF ] [ ↑ ] {X<>Y}.



Matrices


The EL-5200 can store up to 26 matrices A-Z. Operations include determinant, inverse, transpose, and matrix arithmetic. We can get to the arrays at any time by pressing [ 2ndF] [↓].

In fact, the [ 2ndF ] [ ↓ ] toggles between the text (calculator), graphics, and data/array screen.

The [ 2ndF ] [ A ] {DIM} sequence can set the dimensions of a matrix.

In the data screen, we see two elements at one time.


Base Conversions


Integers can be converted between four bases: hexadecimal, binary, decimal, and octal. (bases 16, 2, 10, and 8, respectively) Not much more than arithmetic is offered.



Running Programs

Finally, COMP mode is where we run AER programs. Scroll through the programs with the [ PRO ] button. Start programs and enter data at the prompts by using the [ COMP ] key.


AER I MODE


AER I mode is the classic programming mode for Sharp programming calculators. This mode is meant for simple calculations. The [ f()=/? ] key puts the input form     f( )=. Enter the variables in between the parenthesis, and the variables will automatically be prompted. For example f(AB)= prompts for the variable A, then B. Only global variables (A – Z) are used. Implied multiplication is allowed. This mode is similar to the AER mode of EL-5100 from 1979.



Example: Circular Radius and Circumference

Title:

CIR.1

Code:

M: f( R ) = π × R^2 ⇒ A, 2 × π × R ⇒ C

(spaces are added for readability)


AER II MODE


AER II is the full programming mode. In this mode, we can use both global and local variables, with local variables being the default. Local variables include lower case letters and subscript numbers. Subscript numbers are entered by the sequence [ 2ndF ] [ number key ]. In this mode, the [ f()=/? ] key adds a question mark to the variable and creates a prompt. Unlike AER I, implied multiplication is not allowed.



Example: Graphing a Sine Wave

Title:

Graph A×sin(Bx+C). Set radians mode.

Code:

M: A = ? B = ? C = ? GRAPH A × SIN (B × X + C) AUTO DRAW

(spaces are added for readability)



There is no Radians mode command, so the user has to set Radians mode during program execution.


Common to Both Program Modes



M: This is the main loop.

, (comma): Displays the result of a calculation and pauses the execution. Press [ COMP ] to continue.

␣ (open space) : Finishes a calculation without stopping.

◣ (right triangle): Ends the current program or subroutine.

↳ ↰ : Loop markers

(comparison) -Y→[(do if true)] -N→[(do if false)]: If Then Else Structure.

[ 2ndF ] {SUB}: Creates a new subroutine. Switch between subroutines and the main loop by pressing [ 2ndF ] [ ↑ ] or [ 2ndF ] [ ↓ ].



To create a new program, go to either AER I or AER II mode, press [ COMP ], enter the title. The title is not limited to eight characters. Since we do not have string or string functions, include descriptive information and reminders in the title (see the example in AEI II Mode above).



I find the symbols taking a bit getting used to because we have symbols instead of the regular If-Then-Else-End structure, For-Next loop, Lbl-Goto structure, etc. AER can store complex formulas and best are for simple number crunching.



Overall Thoughts



I like the separate alphabetic keys, but the membrane keyboard calls for extra care when using those keys. The number of features of the EL-5200 are very invented and advanced for 1986. I wish the AER programs had line returns instead everything smashed together in wrap around lines, but it is more for readability. The calculator has a nice, compact form and is fun to work with.


In the future I will be posting AER programs for the EL-5200. It’s rarity makes the EL-5200/EL-9000 collectible.




Sources


Calculator Culture. “Sharp EL-9000 Graphing Calculator from 1986” November 27, 2023.

https://www.youtube.com/watch?v=cw7Gp2Qrmtk


Gelhaus, Matthew & Taia Gelahus. “Sharp EL-5200” gelahus.net. Last Updated December 21, 2023. http://www.gelhaus.net/cgi-bin/page.py?loc:8bit/+content:EL-5200.html Retrieved March 1, 2024.


Magyarra, Váltás “History and Programming of AER Calculators”. Milestone in the History of Calculators. Virtual Museum of Calculators. 2016. Retrieved March 25, 2024. http://www.arithmomuseum.com/szamologep.php?id=25&lang=en


Sharp Corporation. Sharp Scientific Calculator Super Scientific Model EL-9000 Operation Manual. 1986 http://basic.hopto.org/basic/manual/Sharp%20EL-9000%20EN.pdf

(website hosted by hopto.org) (this the same manual for the EL-5200)



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.