Misc Programming Ideas

for Casio Graphic Calculators

Displaying A Series Of Results

If a program outputs a series of numbers, and several of them in a row are the same; more in a row than there are lines on the screen then you won't know the next number has appeared. One solution is to use an intermediate command like ","_ to display a comma between each number. On large screen models 7 equal numbers in a row will cause this problem. On the 6300 only 2 equal numbers in a row will cause this. Also on the 6300: text should immediately be followed by a question mark or a display symbol otherwise the program will carry on to the next statement and you will only see the text flash up very briefly.

Degrees, Mins, Secs Calculations

There doesn't seem to be any explanation of the syntax in the 9850 manual so here goes. Below an apostrophe ' represents the dms symbol on menu: optn f6 f5 f4

To convert 1 deg, 30 mins and 0 secs to 1.5 degs: Enter 1'30'0' and press 'EXE' then it will be converted into decimal.

Using Complex Number Variables To Store Data

(For models with complex numbers built in)

A complex number can be used to store two real values. You can access this like a list of two numbers, with the real part index 1, and imaginary part index 2.

(2-B+iB-i)*R
where R is some real value returns R or R*i depending on whether index B is 1 or 2.
So
X+(2-B+iB-i)*R -> X
will add R to either the real or imaginary part depending on whether index B is 1 or 2.

Rep(2-B-iB+i)X
extracts real or imaginary part of X depending on whether index B is 1 or 2.

Modification Ideas


1)      For calculators without function memory, a program can be rewritten
 so that wherever an f-memory is used replace it with the expression it
 represents. The program will now take up more memory though.

2)      Some programs use the combinations symbol, however you can use an
 alternative. Instead of A nCr B use: (A!)/((B!)(A-B)!) if the combinations
 symbol is not available.

3)      To get a random integer from one to ten use :1+Int 10Ran#:
 To get a random integer from one to 37 use :1+Int 37Ran#:  etc

4)      To use modular arithmetic i.e. to get A mod P then use
         A-P*Int(A/P)      ( and not  P*Frac (A/P) which causes rounding errors )

5)      Normally if you wanted to print out three values you would have to
        use:
        :A_ B_ C_
 but on calculators which allow matrix calculations in a program
 then you could use
        :[[A,B,C]]_
 This displays all three values on the screen at the same time.
 Note that A,B,C must not be complex numbers in this case.
 Or on models with lists, use {A,B,C}_

Calculate Easily Gcd & Lcm Without A Program

The following method works for calculators with a fraction button.
Q: Calculate GCD of 45 and 78.

A: Using fraction button enter 45/78.

   The calculator will remove common factors leaving 15/26.

   It is these common factors you want to get the GCD.

   So since 45 became 15 then GCD(45,78)=45/15=3.

   Similarly 78 became 26 so GCD(45,78)=78/26=3.

   The LCM is either 45*26=1170 or 78*15=1170.


In general to find GCD(a,b)
then use fraction button with a/b to get c/d (make sure a<b)
and GCD(a,b)=a/c=b/d

and LCM(a,b)=a*d=b*c

(c) Roy F. A. Maclean 5th Dec 1997, Updated 15th Jan 2007
rfamgm at gmail
http://www.spiderpixel.co.uk/caspro