Saturday, June 5, 2021

7000G Retro Month - June 5 Edition

7000G Retro Month - June 5 Edition





Introduction


Welcome to the 7000G Retro Month, which features programming for the classic Casio calculators from the mid/late 1980s:  primarily fx-7000G and fx-7500G.  Since the programming language stays similar throughout the years, programs can be translated to the fx-6300G and later graphing calculators with little to no adjustments.  Non graphic programs should be ported to the fx-4000P, fx-4500P (A), fx-3650p (II), fx-50F Plus (II), and fx-5800P with little to no adjustments.  


7000G Retro Month takes place every Saturday during June 2021.


To make text easier to type, I can going to use the following text friendly symbols for the following:


->  for →


/I for ⊿


=> for ⇒


What do you think?   Unicode or simple text equivalents?  


- - - - - - -- - -- - -


Today's subject revolves around General Mathematics.  Enjoy!


- - - -- - - -- - -- -- -



Day Number of the Year


Returns the day number of a year, with January 1 being Day 1 and December 31 being day 365 (or 366 on leap years).  For LEAP? enter 0 for non leap years or 1 for leap years.   


"MONTH"? -> M

"DAY"? -> D

"LEAP"? -> L

M≤2 => D+Int(30.6M+368.8)-399 -> N

M>2 => D+Int(30.6M+1.6)-34+L -> N


Arithmetic-Geometric Mean


The arithmetic-geometric mean of two positive numbers x and y is a convergence of repeated means:


Arithmetic:  a = (x + y)/2

Geometric:  g = √(x y) 


Tolerance:  decimal to determine desired accuracy.  For example, to eight decimal places, set tolerance to 1E-8.  


"AGM"

"A0"? -> X

"G0"? -> Y

"TOL"? -> T

Lbl 1

(X+Y)÷2 -> A

√(XY) -> G

A -> X : G -> Y

Abs (A-G) ≥ T => Goto 1

A /I

G


The final A and G are displayed to show the convergence.  


Now for two classics.


Determinant of a 3 x 3 Matrix


Here the program makes use of the square brackets and indirect storage.  Yes, indirect storage and recall are possible with the fx-7000G and fx-7500G.  Of course, this program is not necessary in later graphing calculators.


A[0] = A

A[1] = B

A[2] = C

A[3] = D

A[4] = E

A[5] = F

A[6] = G

A[7] = H

A[8] = I


Elements are entered left to right, completing row by row.


The determinant is stored in the variable T.


The Isz command is used to increment K by 1.  Since K starts at 0 and K increases by 1 before comparing it, the next command is never going to be skipped.


"3 X 3 DET"

0 -> K

Lbl 1

? -> A[K]

Isz K

K < 9 => Goto 1

A(EI-FH)-B(DI-FG)+C(DH-EG) -> T


Quadratic Formula


I would consider this the "Hello World" of mathematics programs.   


Ax^2 + Bx + C = 0


Let D be the discriminant:  D = B^2 - 4AC.   D is displayed where you can determine the characteristics of the roots:


D ≥ 0:  roots are real, stored in X and Y

D < 0:  roots are complex, that take the form of X + Yi, X - Yi


"A"? -> A

"B"? -> B

"C"? -> C

B^2-4AC -> D /I

D<0 => Goto 1

(-B+√D)÷(2A) -> X

(-B-√D)÷(2A) -> Y

Goto 2

Lbl 1

-B÷(2A) -> X

√ Abs D ÷(2A) -> Y

Lbl 2

X /I Y


Eddie


All original content copyright, © 2011-2021.  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. 


  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...