Friday, May 16, 2014

fx-5800p Programs (can apply to Casio graphing calculators also, e.g. fx-9860g, Prizm)

This is a collection of programs I wrote on the Casio fx-5800p. These programs should also work on any Casio Graphing calculator (fx-9860g, fx-9750g, Prizm) since the programming language between Casio calculators remains largely the same.

Now if I can find my fx-5800p that I misplaced last night... *sigh*. Thank goodness for notes!

Notes for the fx-5800p programs:


There are no SIGN or MOD functions. Here are the work arounds I used (see SUN):

SIGN(x):
...
X > 0 ⇒ 1 → X
-X > 0 ⇒ -1 → X
...

n MOD d:
...
N - D Intg( N ÷ D ) → result variable
....

Table of Contents:

1. Rotation of (x, y) (ROTATEXY)
2. Law of Cosines (COSINES)
3. Pendulum: Period and Average Velocity (PENDULUM)
4. Arc Length of a Parabola (QUADLENGTH)
5. Position of the Sun (SUN)



1. fx-5800p: ROTATEXY

Rotates the coordinate (X, Y). The direction of rotation follows the conventional direction (counterclockwise). The variable A represents the angle (θ).

Program:
"X"? → X
"Y"? → Y
"ANGLE"? → A
[ [ X, Y ] ] × [ [ cos(A), sin(A) ] , [ -sin(A), cos(A) ] ]


2. fx-5800p: COSINES

Sides: D, E, F
Corresponding Angles: A, B, C

Program:
Lbl 0
Cls
"KNOWN:"
"1. D,E,F"
"2. A,E,F"
?→I
I = 1 ⇒ Goto 1
I = 2 ⇒ Goto 2
Goto 0
Lbl 1
"D"? → D : "E"? → E : "F"? → F
"A" : cos ⁻¹ (( E ² + F ² - D ² ) ÷ ( 2EF )) → A ◢
"B": cos ⁻¹ (( D ² + F ² - E ² ) ÷ ( 2DF )) → B ◢
"C" : 180° - A - B
Stop
Lbl 2
"A"? → A : "E"? → E : "F"? → F :
"D": √ (E ² + F ² - 2 E F cos A ) → D ◢
"B" : cos ⁻¹ ( ( D ² + F ² - E ² ) ÷ (2DF)) → B ◢
"C": 180° - A - B

3. fx-5800p: PENDULUM

Variables:
D = length of the step or bar holding the pendulum
L = length of the rod or string that is swinging
R = large radius of the circular ring

At the units, enter 0 for US units (set g = 32.174 ft/s^2), anything else for SI units (g = 9.80665 m/s^2).

Calculated:
T = period of the pendulum (the amount of time it takes for the pendulum from one end to the other)
V = average velocity of the pendulum (once in its in full swing)


Program:
Cls
"=0 U.S."
"≠0 SI"
? → G
If G = 0
Then 32.174 → G
Else g → G IfEnd // g from the constant menu (9.80665)
Lbl 0
Cls
"1. ROD 2. STRING"
"3. RING"
?→ I
I = 1 ⇒ Goto 1
I = 2 ⇒ Goto 2
I = 3 ⇒ Goto 3
Goto 0
Lbl 1
"D"? → D : "L"? → L
2 π √( L ÷ 3G ) → T : Goto 4
Lbl 2
"D"? → D : "L"? → L
2 π √(L ÷ G) → T : Goto 4
Lbl 3
"D"? → D : "L"? → L : "R"? → R
2 π √( R ² ÷ GL → T : Goto 4
Lbl 4
"T =" : T ◢ "V =": D ÷ T → V

-----

Test Examples:

Rod: D = 1 m, L = 1.6 m. Results: T = 14.36943096 sec, V = .0695921782 m/s

String: D = 2 m, L = 1.75 m. Results: T = 2.65423008 sec, V = .07535141995 m/s

Circular Ring: D = 2 ft, L = 2 ft, r = 1.2 ft
Results: T = 1.879851674 sec, V = 1.063913727 m/s

4. fx-5800p: QUADLENGTH

Find the length of a parabola given height and width and a corresponding equation:

f(x) = Ax^2 + Bx

Where
A = -4h/l^2
B = 4h/l

Program:
Cls
"LENGTH"? → L
"HEIGHT"? → H
Cls
"COEF OF X ²"
-4 H ÷ L ² ◢
"COEF OF X"
4 H ÷ L ◢
"ARC LENGTH"
∫ ( √ ( 1 + ( -8 H X ÷ L ² + 4 H ÷ L ) ) , 0, L)


Test Data:
L: 16.4, H: 8.2
X^2 coefficient: -.1219512195
X coefficient: 2


5. fx-5800P: SUN

Source for the formulas: http://aa.usno.navy.mil/faq/docs/SunApprox.php

Gives the RA (right ascension) and δ (declination) of the sun at any date. U is the universal time, the time it would be at Greenwich Village (Int'l Date Line).

For the Pacific Time Zone:
Standard Time: PST + 8 hours = UT
Daylight Savings Time: PDT + 7 hours = UT

Program:
"MONTH"? → M
"DAY?" → D
"YEAR"? → Y
"UNIV. TIME"? → U
Deg
100 Y + M - 190002.5 → X
X > 0 ⇒ 1 → X
-X > 0 ⇒ -1 → X
367 Y - Intg( 7 ( Y + Intg( ( M + 9 ) ÷ 12 ) ) ÷ 4 )
+ Intg( 275 M ÷ 9 ) + D + 1721013.5 + U ÷ 24
- .5 X + .5 → D
D - 2451545 → D
357.529 + .98560028 D → G
G - 360 Intg( G ÷ 360 ) → G
280.459 + .98564736 D → Q
Q - 360 Intg( Q ÷ 360 ) → Q
Q + 1.915 sin( G ) + .02 sin( 2G ) → L
L - 360 Intg( L ÷ 360 ) → L
1.00014 - .01671 cos( G ) - .00014 cos( 2 G ) → R
23.439 - .00000036 D → E
tan ⁻¹ (cos(E) tan(L)) → A
If L ≥ 90 And L < 270
Then A + 180 → A
IfEnd
If L ≥ 270 And L < 360
Then A + 360 → A
IfEnd
A ÷ 15 → A
sin ⁻¹ ( sin(E) sin(L) ) → C
"APPROX:"
"RA (HRS)": A ◢
"DEC (DEG)": C


Test Data:
M: 5
D: 14
Y: 2014
U: 19

RA: 3.43 hours
DEC: 18.746°


Eddie

This blog is property of Edward Shore. 2014

4 comments:

  1. Hi Eddie, so I had a question for you, I'm a cnc machinist and I use some basic geometry and trig. I had a calculator by "calculated industries" it was handy. Quite clever really. All you did was enter a numerical value and press "oop, adj, hyp, angles" and it would solve for trig functions as well as Pythagorean Therom. Do you think it would be possible to write a program to do this on this calulator?

    ReplyDelete
  2. The formula with the Matris is a little bit wrong:
    [[X,Y]]×[[cos(A),sin(A)],[-sin(A),cos(A)]]

    the right one is:
    [[X,Y]]×[[cos(A),sin(A)][-sin(A),cos(A)]]
    (without the second komma)

    ReplyDelete
  3. i think the comma means the next row on the matrix

    ReplyDelete
  4. can you make a mohr circle that takes stresses as inputs and asks for a specific rotation?

    ReplyDelete

Next Week... and Plans for October 2017

I'm so excited, can't want for next week's HHC 2017 calculator conference in Nashville!  It is my annual calculator conference ...