Monday, February 14, 2022

Casio fx-5800P: Convert to Fractions by Pierre Gillet

 Casio fx-5800P: Convert to Fractions by Pierre Gillet


The program on this blog entry are created and authored by Pierre Gillet.   Gratitude for his permission to post this on my blog.  The program FRAC will show successful approximations of fractions.  Note, the program uses 30 additional registers by the DimZ command.  


Take it away, Pierre.


Casio fx-5800P FRAC and Notes


    Casio fx-5800P:

    "FRAC":

    ?X : Abs(X)->Z

    30->DimZ : 0->W

    Lbl 1    

    W+1->W

    Int(Z)->Z[W]

    Z[W]->R : 1->S

    For W-1->I TO 1 Step -1

    R->T

    Z[I]*R+S->R : T->S

    Next

    Cls : Locate 1,1,R

    Locate 1,2,"÷"

    Locate 2,2,S

    Locate 1,3,"="

    Locate 2,3,R/S

    Locate 1,4,R/S-Abs(X)◢

    1/Frac(Z)->Z

    Goto 1


Notes:


     ?X is allowed on the fx-5800P:   When executed, the last value of X is shown which can be accepted or replaced. It doesn't work for the Casio graphing calculators. 

     The program works with the absolute value of X

     The program uses 30 DimZ extra memories (from Z[1] to Z[30]) by default; If it's not enough, it will display "Dimension ERROR"

     The program pauses displays pauses after each step, displaying 4 lines per step, until it suits you:

         Numerator

         Denominator

         Result of the division of Numerator by Denominator

         Absolute error, compared to absolute value of X

For example, at the 4th step with X=Pi, the program will display:


         355

         ÷113

         =3.14159292

         2.6676418x10^-7


     The fx-5800P doesn't allow "A=";A  to display "A=8"  (if A=8) 


BUT you can bypass this using Locate <Column>, <Row>, <String or Variable>

For example, in order to display "A=8"  (if A=8)  at the beginning of the first row of the display, do:


     Locate 1,1,"A="

     Locate 3,1,A



Examples


0.675 -> 27/40 after 4 steps  


2.08080808 -> 26,010,101/12,500,000 with approximately 0 difference


1.37456356 -> 1,812,138/1,318,337  with approximately 0 difference 



Thank you to Pierre Gillet.


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.  Programs provided by Pierre Gillet with permission, © 2022.   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...