Source code © 1985-2023 Guillaume Dargaud.

Free use, distribution and modification.

Last updated on 2021/11/05

"You can bring any calculator you like to the midterm, as long as it doesn't dim the lights when you turn it on."

Here is a bunch of programs I wrote 10~15 years ago, when I was still a student. At the time I was selling them to other students in a booklet ! If I had had to live off my programming skills at the time, I'd have died of starvation long ago. Those programs will work on the FX-7000G and other Casio calculators as well. I had many more, but I doubt much people are interested in action games on a calculator anymore... Those are just the few programs I still use.

**Note 1:** some keys of the FX-8000G cannot be represented accurately on a PC. So I use the '¬' symbol for the variable setting arrow (same key as '?' and 'H'), '»' for the test fat arrow ([Shift][7]), '¶' for display value ([Shift][:])...

**Note 2:** the main *program memory* (Mode 2) is used for functions and very basic progs. The *editor memory* (Mode 0) is used for the actual programs. Some programs call each others, so it's advised to keep the names (I made them very short to save off memory, we didn't have GigaBytes in our pocket calculators at the time).

Contains functions of 'X'. Referenced later as F(X). Example:

X²-1

Contains parametric functions of 'T'. Referenced later as as X(T) and Y(T). Example:

cos 3T¬X sin T¬Y

Contains functions of 'X' and 'Y', possibly using 'R' as an intermediate variable (do not use other variable names). Referenced later as Z(X,Y). Example:

X²+Y²¬R 40sin R÷R

Program to get F(X):

"X"?¬X:Prog 0

Program to get X(T) and Y(T):

"T"?¬T:Prog 1:X¶ Y

Program to get F(X,Y):

"X"?¬X:"Y"?¬Y:Prog 2

Ask for limits (like -10, 10) and a number of steps (like 10).

"A"?¬A:"B"?¬B:"P"?¬P

Just this, two quotes with 7 [EXE] in between. Used to avoid screen flicker in graphic programs.

" "

Ask for limits (like -10, 10) and a number of steps (like 100) and compute the integral of F(X) as written in Prog 0. Increase P for better precision but slower computation. Example with F(X)=X²-1, A=-10, B=30, P=100 returns 9293.333333.

Prog "IN":Prog "NS"

Computes an integral (needs A, B and P). Second order polynomial.

A¬X:Prog 0:Ans¬I (B-A)÷2P¬D Lbl 0 X+D¬X Prog 0:I+4Ans¬I X+D¬X Prog 0:I+2Ans¬I Dsz P:Goto 0 B¬X:Prog 0 (I-Ans)D÷3

Classic dichotomy program. Ask for limits (like 0, 10) and a number of precision digits (like 5) and search for X so that F(X)=0 as written in Prog 0. Increase P for better precision but slower computation. Example with F(X)=X²-1, A=0, B=10, P=5 returns 1.000003815. You should have F(A) and F(B) of opposite sign, if not the program returns "Err".

Prog "IN" A¬X:Prog 0:Ans÷Abs Ans¬D B¬X:Prog 0:Ans÷Abs Ans¬E_{10}-P¬C D-E=0»Goto 2 D<0»Goto 3 Lbl 0:.5(A+B)¬X Prog 0 Ans≥C»Goto 1 Ans>-C»Goto 4 X¬B:Goto 0 Lbl 1:X¬A:Goto 0 Lbl 2:"Err":Goto 5 Lbl 3:A¬Q:B¬A:Q¬B:Goto 0 Lbl 4:X Lbl 5

Solve a linear system of *Dim* equations of *Dim* unknown using Gauss method. For instance *x+2y+3z=14; 4x+5y+6z=32; 7x+8y+9z=23*. Equivalent to returning vector *Sol* so that *MatxSol=Col*.

The program first asks for the dimension "Dim" of the system (ex: 3), then each coefficient of the each line "Lin" of the system (ex: 1,2,3; 4,5,6; 7,8,9), then it asks for the vector "Col" (ex: 14,32,23), then it returns the solution "olS" in reverse order (here: 3,2,1). Prints "End" after the last value. You need 4+Dim²+2Dim memories. Use Defm (Mode .) to declare memories after 26.

Mcl:"Dim"?¬D:"Mat" Lbl 8:0¬A:B+1¬B "Lin" Lbl 9:A+1¬A:?¬D[A+(B-1)D] A<D»Goto 9 B<D»Goto 8 "Col":0¬B Lbl 7:B+1¬B:?¬D[D²+B] B<D»Goto 7 1¬C Lbl 0:C+1¬B Lbl 1:D[C+(B-1)D]D[D²+C]-D[C+(C-1)D]D[D²+B]¬D[D²+B] C+1¬A:Lbl 2 D[C+(B-1)D]D[A+(C-1)D]-D[C+(C-1)D]D[A+(B-1)D]¬D[A+(B-1)D] A+1¬A:A≤D»Goto 2 B+1¬B:B≤D»Goto 1 C+1¬C:C≤D»Goto 0 "olS" D[D²+D]÷D[D²]¬D[D²+D]¶ D¬B Lbl 3:B-1¬B:D+1¬A Lbl 4:A-1¬A D[D²+B]-D[A+(B-1)D]D[D²+A]¬D[D²+B] A>B+1»Goto 4 D[D²+B]÷D[B+(B-1)D]¬D[D²+B]¶ B>1»Goto 3 "End"

Split an integer number to its prime factors. Example: `1224:Prog "D"` will return `2, 2, 2, 3, 3, 17, 1`, so that 1224=2³.3².17. You need to press [EXE] between each factor. The program finishes with 1. Big prime numbers take a long time...

Ans¬N:5¬I:2¬K Lbl 9:.5N≠Int .5N»Goto 8 .5N¬N:2¶ Goto 9 Lbl 8:N÷3¬T:T≠Int T»Goto 0 T¬N:3¶ Goto 8 Lbl 0:N÷I¬A:A=Int A»Goto 1 I+K¬I:6-K¬K N≥2»Goto 0:Goto 2 Lbl 1:I¶ A¬N:Goto 0 Lbl 2:1

Plot the parametric curve X(T),Y(T). You need to set the bounds A and B and the number of steps P. You also need to set the correct (or at least wider) [Range] for the graphic window.

Try the example given above in *Prog 1* with `A=0, B=2π, P=100, Range=-1,1,0,-1,1,0`

. Make sure you are in Radians (Mode 5).

Prog "IN":Prog "CL" (B-A)÷P¬H:A¬T:Prog 1:Plot X,Y Lbl 0:T+H¬T:Prog 1:Plot X,Y:Line T<B»Goto 0

Iterate F(X) on itself n-i times starting from a given value. Equivalent to finding X_{n} knowing X_{i} with X_{i+1}=F(X_{i}). F is defined in Prog 0. Example: Xi=2, i=0, n=5 returns X_{n}=2.479057493E+14.

"Xi"?¬X "i"?¬N "n"?¬M Lbl 0:Prog 0:Ans¬X Isz N:N≤M»Goto 0 X

If N/D is a fraction (N and D are 2 integers), the program returns the smallest Q and R possible so that N/D=Q/R. N stands for **N**umerator, D for **D**enominator. Example: N=96, D=60 returns 8/5.

"N"?¬A:"D"?¬B~D:A¬E A<B»Goto 2 Lbl 0 Int (.5+BFrac (A÷B¬R R=0»Goto 1 B¬A:R¬B~C Goto 0 Lbl 2:A¬C:B¬A:C¬B:Goto 0 Lbl 1:E÷C¶ D÷C

Let I(X) be the integral of F(t)dt (the function present in Prog 0, always as a variable of X) between G(X) and H(X). G and H are 2 functions of X defined in Prog 1 and Prog 2 (for example G(X)=0 and H(X)=X will display the integral of F, here X³/3-X, set A=-1, B=1, P=100).

Do not be confused by the use of X as the parameter for the inner integral (here dt).

Prog "IN":Prog "CL" A¬E:B¬F 0¬T:(F-E)÷P¬J Lbl 1:5¬P:E¬X Prog 1:Ans¬A Prog 2:Ans¬B Prog "NS":Ans¬Y T≠0»Goto 2 1¬T:Plot E,Y Lbl 2:Plot E,Y:Line E+J¬E:E≤F»Goto 1

Contour plot ??? can't remember !!!

_{10}-3¬E Lbl 0 "X"?¬X:"Y"?¬Y:"P"?¬P Prog "DPC" Plot X,Y Lbl 1:Prog 1 P÷Pol(A,B¬C X+BC¬X Y-AC¬Y Prog "DPC" X¬A:Y¬B:Plot X,Y:A¬X:B¬Y:Goto 1

??? can't remember !!!

Lbl 0 Prog 2:Ans¬Z Abs Z<E»Goto 9 Prog 1 Z÷(A²+B²¬F X-AF¬X Y-BF¬Y Goto 0:Lbl 9

Decomposition of the F(X) function at a given point (A) in a polynomial P(X)=E[0]+E[1]X+E[2]X²+E[3]X³...=E+FX+GX²+HX³+...

The function approximate each coef one after the other. Before approximating the next one, it needs an exact value for the preceding ones, so it asks you for confirmation. Example of use with `sin X÷X`

in Prog 0:

Prog output | You type | Comment |
---|---|---|

Prog "DL" | ||

A | 0 | Point where to find the polynomial |

1,-1,0Coef Xx ^{y}00.9999974569 ? | 1 | Ask if constant coef (x^{0}) is good.We can guess it's 1, but lets increase the resolution by putting 1 (means that we think the real value of the coef is higher than the approximated one. |

0.9999993642? | 0 | It seems to converge to 1, lets accept it by typing 0. |

E[Y]? | 1 | Ask the real value. We give one. |

1,-1,0Coef Xx ^{y}1-6.510412544e-4 ? | 1 | Close to 0, but lets approximate more. |

-3.255207424e-4? | 0 | Getting closer to 0, lets accept it. |

E[Y]? | 0 | We give 0 as the real value. |

1,-1,0Coef Xx ^{y}2-0.1666665611 ? | 0 | We recognize -1/6 |

E[Y]? | -1÷6 | Note that using "-1÷6" is more precise than using -0.166666666666 by 3 decimals. |

1,-1,0Coef Xx ^{y}32.68435456e-5 ? | 0 | We recognize 0 |

E[Y]? | 0 | We give 0 |

1,-1,0Coef Xx ^{y}46.871947674e-3 ? | -1 | Lets see if it converges to 0. |

8.348342682e-3? | 1 | Does not go to 0. Let's see the other way |

6.871947674e-3? | Mode 1 | Let's accept it and quit |

Now lets plot our equations: `Range=-6,6,1,-0.5,1,0.5; Graph=sin X÷X; Graph=E+GX²+IX²²`. In the area -3<X<3 we see that the concordance is very good.

"A"?¬A:0¬Y Lbl 0:"1,-1,0" 2x^{y}-8¬B "Coef Xx^{y}":Y¶ Lbl 2 0¬C:Y=0»Goto 3 E[Y-1¬C:Y=1»Goto 3 Y-1¬Z:Lbl 1 CB+E[Z-1¬C Dsz Z:Goto 1 Lbl 3 A+B¬X:Prog 0 (Ans-C)÷Bx^{y}Y¬E[Y]¶ ?¬D D>0».5B¬B D<0»2B¬B D≠0»Goto 2 "E[Y]"?¬E[Y] Isz Y:Goto 0

??? can't remember !!!

Prog "IN" (B-A)÷P¬H:.5H¬J "Y0"?¬B:Plot A,B Lbl 0 A¬X:B¬Y:Prog 2:Ans¬C A+J¬X:B+JC¬Y:Prog 2:Ans¬D B+JD¬Y:Prog 2:Ans¬E A+H¬X:B+HE¬Y:Prog 2:Ans¬F B+H(C+2D+2E+F)÷6¬B A+H¬A:Plot A,B:Line Dsz P:Goto 0