Post Reply 
New Casio fx-9860 GIII model
01-01-2021, 01:25 PM
Post: #61
RE: New Casio fx-9860 GIII model
(10-21-2020 12:47 AM)Druzyek Wrote:  My fx-9750GIII came in the mail today, and it's really impressive! The Python implementation seems to work really well. The manual says the editor can only handle files with up to 150 lines, though it can execute files larger than that. This is kind of annoying but not a dealbreaker. The latest OS update adds the casioplot module so you can use graphics from Python. I also read that the calculator uses the same processor as the Prizm, so it runs at 58MHz instead of 29MHz like the g and gii models. The spreadsheet mode and e-activity mode, which seems to be like a Jupyter notebook, are also really neat. They probably aren't news to most people but this is the first new Casio I've gotten since the AFX 2.0+ Smile

One thing I have not figured out is how to open a text file from Python. The "open" command is supported but returns "NoneType" since I'm probably missing the path for the file I'm trying to open. Anyone know how to do it?

Another thing that would be interesting is inlining assembly, which MicroPython supports with a decorator: 10. Inline assembler. The calculator recognizes @micropython as a decorator, but I couldn't get it to recognize .asm or .asm_sh4. With a limit of 150 lines, you couldn't write much assembly, but it might be enough to jump into a library written in C and designed to be called from Python.


This posts makes me confused. I bought a FX9860GIII one month ago and there is no "casioplot" module installed for the built-in uPython, and no OS update from CASIO.

Also, does the FX9860GIII use the same SDK released for the FX9860GII?
Find all posts by this user
Quote this message in a reply
01-01-2021, 08:37 PM (This post was last modified: 01-01-2021 08:38 PM by critor.)
Post: #62
RE: New Casio fx-9860 GIII model
(01-01-2021 01:25 PM)DiTBho Wrote:  
(10-21-2020 12:47 AM)Druzyek Wrote:  My fx-9750GIII came in the mail today, and it's really impressive! The Python implementation seems to work really well. The manual says the editor can only handle files with up to 150 lines, though it can execute files larger than that. This is kind of annoying but not a dealbreaker. The latest OS update adds the casioplot module so you can use graphics from Python. I also read that the calculator uses the same processor as the Prizm, so it runs at 58MHz instead of 29MHz like the g and gii models. The spreadsheet mode and e-activity mode, which seems to be like a Jupyter notebook, are also really neat. They probably aren't news to most people but this is the first new Casio I've gotten since the AFX 2.0+ Smile

One thing I have not figured out is how to open a text file from Python. The "open" command is supported but returns "NoneType" since I'm probably missing the path for the file I'm trying to open. Anyone know how to do it?

Another thing that would be interesting is inlining assembly, which MicroPython supports with a decorator: 10. Inline assembler. The calculator recognizes @micropython as a decorator, but I couldn't get it to recognize .asm or .asm_sh4. With a limit of 150 lines, you couldn't write much assembly, but it might be enough to jump into a library written in C and designed to be called from Python.


This posts makes me confused. I bought a FX9860GIII one month ago and there is no "casioplot" module installed for the built-in uPython, and no OS update from CASIO.

Your fx-9860GIII is probably preloaded with OS version 3.21.
Just update to latest version 3.40 (2020 November 25th) in order to get the casioplot module in Python :
http://edu.casio.com/dl/
Find all posts by this user
Quote this message in a reply
01-16-2022, 03:30 PM
Post: #63
RE: New Casio fx-9860 GIII model
(10-21-2020 12:47 AM)Druzyek Wrote:  My fx-9750GIII came in the mail today, and it's really impressive! The Python implementation seems to work really well. The manual says the editor can only handle files with up to 150 lines, though it can execute files larger than that. This is kind of annoying but not a dealbreaker. The latest OS update adds the casioplot module so you can use graphics from Python.

I've tried casioplot to create some graphics, but cannot figure out how to wait for a keypress. The problem is that the input() function switches back to the text screen. For example:

Code:
from casioplot import *
def example():
  clear_screen()
  for i in range(1,379)
    set_pixel(i,100)
  show_screen()
  x=input()

On my fx-CG50 this very briefly displays the line drawn, but immediately switches to the text screen to wait for input().

- how to read a keypress without losing the casioplot screen?
- how to check for a keypress without waiting?
- are the any other graphics drawing commands, other than just set_pixel()? There is no line() no circle() no fill() no paint()?
- how to specify colors (fx-CG50)?

My other issue with the fx-CG50 is that it has no built-in help for the calculator's features or for Python. Sure, the CATALOG has a QR feature to pull up the calculator instructions online, but not for Python as far as I can tell. BTW does anyone know anyone else who thinks that help via a QR code was a good idea? By comparison, my Casio FX-9860G Slim has a help button and shows a dialogue box with a short help message. I don't use it as often as when I got the Slim, but it is still a nice reminder how to use not-so-often used functions. Something like that is really a must-have to be able to use Casio-specific Python imports such as casioplot.

Python graphics is nice to have on the fx-CG50. The Casio plot and line commands are slow as molasses. Whereas the HP Prime instantly displays lines in PPL, the Casio takes forever to draw graphics. To demonstrate what I mean:

Casio Basic program:

Code:
' Hitomezashi patterns
384-4→H↵
216-28→V↵
ViewWindow 1,H-1,H,1,V,V-1↵
8→S↵
For 1→Y To V-1 Step S↵
SInt 2Rnd# →I↵
For I+1→X To H-1 Step S↵
Blue Plot X,Y↵
Blue Plot X+S,Y↵
Blue Line↵
Next↵
Next↵
For 1→X To H-1 Step S↵
SInt 2Rnd# →I↵
For I+1→Y To V-1 Step S↵
Blue Plot X,Y↵
Blue Plot X,Y+S↵
Blue Line↵
Next↵
Next↵

This takes minutes to complete.

By contrast, the HP Prime PPL program draws the same pattern instantly with Hitomezashi(8):

Code:
EXPORT Hitomezashi(S)
BEGIN
LOCAL X,Y,I,C;
C:=RGB(0,0,255);
RECT_P():
FOR Y FROM 0 TO 239 STEP S DO
 X:=S*RANDINT();
 FOR I FROM X TO 319 STEP 2*S DO
  LINE_P(I,Y,I+S,Y,C)
 END;
END;
FOR X FROM 0 TO 319 STEP S DO
 Y:=S*RANDINT();
 FOR I FROM Y TO 239 STEP 2*S DO
  LINE_P(X,I,X,I+S,C)
 END;
END;
WAIT();
END;

I haven't yet tried a HP Prime Python program for this, but I bet it is at least as fast.

About Hitomezashi patterns: https://www.youtube.com/watch?v=JbfhzlMk2eY

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
01-19-2022, 08:36 PM (This post was last modified: 01-19-2022 08:37 PM by critor.)
Post: #64
RE: New Casio fx-9860 GIII model
(01-16-2022 03:30 PM)robve Wrote:  - how to read a keypress without losing the casioplot screen?
- how to check for a keypress without waiting?

If it's for a pause, you can wait for the [AC/ON] key to be pressed :
Code:
def wait_acon_key():
  try:
    while(1):
      pass
  except KeyboardInterrupt:
    pass
But that's all for the time being, there is no getkey()-like function in the fx-CG50 Python.

(01-16-2022 03:30 PM)robve Wrote:  - are the any other graphics drawing commands, other than just set_pixel()? There is no line() no circle() no fill() no paint()?
No, there aren't. You have to build them yourself by using set_pixel(), and optimize them as much as possible.

(01-16-2022 03:30 PM)robve Wrote:  - how to specify colors (fx-CG50)?
Last parameter of the drawing functions :
Code:
set_pixel(x, y, color)
draw_string(x, y, string, color)
Where color is (255,0,0) for red for example.
Find all posts by this user
Quote this message in a reply
01-21-2022, 03:28 PM (This post was last modified: 01-24-2022 02:11 PM by robve.)
Post: #65
RE: New Casio fx-9860 GIII model
(01-19-2022 08:36 PM)critor Wrote:  If it's for a pause, you can wait for the [AC/ON] key to be pressed :
Code:
def wait_acon_key():
  try:
    while(1):
      pass
  except KeyboardInterrupt:
    pass
But that's all for the time being, there is no getkey()-like function in the fx-CG50 Python.

Thanks for the suggestions.

Here is my line() function to draw lines between two arbitrary points (x1,y1) and (x2,y2) given a color (R,G,B):

Code:
def line(x1,x2,y1,y2,color):
  x1=int(x1)
  x2=int(x2)
  y1=int(y1)
  y2=int(y2)
  dx=x2-x1
  dy=y2-y1
  if abs(dx)>=abs(dy):
    s=1 if x2>x2 else -1
    d=s*dy/dx
    for x in range(x1,x2+s,s)
      set_pixel(x,y1,color)
      y1+=d
  else:
    s=1 if y2>y2 else -1
    d=s*dx/dy
    for y in range(y1,y2+s,s)
      set_pixel(x1,y,color)
      x1+=d

This line() function can be a bit optimized for horizontal and vertical lines (i.e. when d=0), but that does not appear to make a substantial difference.

Casio fx-CG50 program to draw Hitomezashi patterns. Should also work on a Casio 9860GIII when you leave out the color parts:

Code:
from casioplot import *
from random import randint

def wait():
  try:
    while 1:
      pass
  except KeyboardInterrupt:
    pass

def line(x1,x2,y1,y2,color):
  x1=int(x1)
  x2=int(x2)
  y1=int(y1)
  y2=int(y2)
  dx=x2-x1
  dy=y2-y1
  if abs(dx)>=abs(dy):
    s=1 if x2>x2 else -1
    d=s*dy/dx
    for x in range(x1,x2+s,s)
      set_pixel(x,y1,color)
      y1+=d
  else:
    s=1 if y2>y2 else -1
    d=s*dx/dy
    for y in range(y1,y2+s,s)
      set_pixel(x1,y,color)
      x1+=d

def hitomezashi():
  color=(0,0,255)
  while 1:
    s=int(input("s="))
    clear_screen()
    for y in range(0,188,s):
      i=s*randint(0,1)
      for x in range(i,380,2*s):
        line(x,y,x+s,y,color)
    for x in range(0,380,s):
      i=s*randint(0,1)
      for y in range(i,188,2*s):
        line(x,y,x,y+s,color)
    show_screen()
    wait()

hitomezashi()

   

Nice that Casio has Python. But casioplot requires quite some scaffolding to create something useful, making programs quite long.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)