CASIO Graph 90+E
|
08-23-2018, 05:28 PM
Post: #41
|
|||
|
|||
RE: CASIO Graph 90+E
(08-23-2018 08:47 AM)m@x Wrote:(08-11-2018 10:44 PM)StephenG1CMZ Wrote: BTW, authors say "morning has broken" at daybreak - astronomers think "morrning just worked normally" Originally, the last line was "...fresh from the Word" meaning the word of God. Tom L Cui bono? |
|||
08-30-2018, 02:39 PM
(This post was last modified: 08-30-2018 02:40 PM by severedgarden.)
Post: #42
|
|||
|
|||
RE: CASIO Graph 90+E
The update for the Casio Graph 90 +e and its out-of-France equivalent, the fx CG50 is here!
We can use MicroPython! https://edu.casio.com/download_service/e...index.html A day before than expected! I will try it tonight |
|||
08-30-2018, 03:53 PM
Post: #43
|
|||
|
|||
RE: CASIO Graph 90+E
(08-30-2018 02:39 PM)severedgarden Wrote: The update for the Casio Graph 90 +e and its out-of-France equivalent, the fx CG50 is here! FYI - In USA, this link redirects to: http://edu.casio.com/index.php It seems Casio is trying hard to limit distribution to certain locales.... --Bob Prosperi |
|||
08-30-2018, 03:54 PM
(This post was last modified: 08-30-2018 05:15 PM by Dave Britten.)
Post: #44
|
|||
|
|||
RE: CASIO Graph 90+E
Whoa, awesome! I was under the impression Python was only coming to the Graph 90+E model. Glad I was wrong!
EDIT: It can run the standard 8x8 n-queens benchmark (http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=700) in a bit under one second. (I just did a quick port of the generic Pascal version on that page.) |
|||
08-30-2018, 06:15 PM
Post: #45
|
|||
|
|||
RE: CASIO Graph 90+E
I downloaded the update from site mentioned above
http://edu.casio.com/download/index.php After downloading I updated my fx-CG50 bought in Germany and the item "Python" is included in the calc. I tried the simple program named octa from the UG and it is functional. |
|||
08-30-2018, 09:51 PM
Post: #46
|
|||
|
|||
RE: CASIO Graph 90+E
Can the Casio screen pixels be addressed from microPython (e.g. to draw Mandelbrot)?
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
08-30-2018, 09:57 PM
Post: #47
|
|||
|
|||
RE: CASIO Graph 90+E
Not that I could find in the manual, unfortunately. It only has print and input for I/O. (Maybe file I/O too; I didn't look for that.)
|
|||
09-01-2018, 10:40 AM
Post: #48
|
|||
|
|||
RE: CASIO Graph 90+E
(08-30-2018 03:54 PM)Dave Britten Wrote: EDIT: It can run the standard 8x8 n-queens benchmark (http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=700) in a bit under one second. (I just did a quick port of the generic Pascal version on that page.) Would be nice to have your test result and the code in the list, if you are also interested. If yes, can you please check the execution time with an outer loop of 100 iterations for a more accurate result? The CG20 needs 39.7 seconds with BASIC. Strangely using MAT is a bit faster than using a list. Code: 0->A~Z I guess the CG50 should do it in around 20 seconds. Calculator Benchmark |
|||
09-03-2018, 02:06 PM
Post: #49
|
|||
|
|||
RE: CASIO Graph 90+E
(09-01-2018 10:40 AM)xerxes Wrote:(08-30-2018 03:54 PM)Dave Britten Wrote: EDIT: It can run the standard 8x8 n-queens benchmark (http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=700) in a bit under one second. (I just did a quick port of the generic Pascal version on that page.) 100 runs took a total of about 29 seconds. The code is listed below; should work for just about anything that runs Python. Code: for i in range(100): |
|||
09-03-2018, 05:52 PM
(This post was last modified: 09-03-2018 06:18 PM by gomefun2.)
Post: #50
|
|||
|
|||
RE: CASIO Graph 90+E
Your code works but could be made faster.
I also ran your code and got about 29 seconds, then I watched this video: https://www.youtube.com/watch?v=hHec4qL00x0 I only followed his first point of advice by making your code a function by adding one single line of code I sped up your code from 29 seconds down to 13 seconds! I didn't really watch the rest of the video yet to see if there are even more things that could be done. I'm not a computer scientist though, more of an engineer, and I don't really use python too much. def XXX(n): for i in range(n): a = [0] * 9 r = 8 s = 0 x = 0 y = 0 t = 0 while True: x += 1 a[x] = r while True: s += 1 y = x while y>1: y -= 1 t = a[x]-a[y] if t==0 or x-y==abs(t): y=0 a[x] -= 1 while a[x]==0: x -= 1 a[x] -= 1 if y==1: break; if x==r: break; print(s) |
|||
09-03-2018, 06:43 PM
Post: #51
|
|||
|
|||
RE: CASIO Graph 90+E
Now that's a pretty surprising difference. I just confirmed the same on mine (12-13 seconds or so). My educated guess is that pushing the variables down to a function-local scope lets Python do less housekeeping of globals.
|
|||
09-03-2018, 08:14 PM
Post: #52
|
|||
|
|||
RE: CASIO Graph 90+E
Based on the video: global variables need a look-up in a hash-map while local variables can be accessed directly on the stack.
Conclusion: Avoid global variables. Cheers Thomas |
|||
09-04-2018, 11:08 AM
Post: #53
|
|||
|
|||
RE: CASIO Graph 90+E
Thanks to Dave and gomefun2 for testing. What a significant difference between global and local variables in this case.
Unfortunately there seems to be no graphics support, what is very strange for a graphing calculator. Calculator Benchmark |
|||
09-04-2018, 11:50 AM
Post: #54
|
|||
|
|||
RE: CASIO Graph 90+E
After watching the mentiond video, I noticed that normally MicroPython compiles to bytecode, but there seems to be also a native code mode,
if @micropython.native is used at the beginning of the function. Maybe we can go much faster, if @micropython.native does work on the CG50. I guess we need 1000 or 10000 iterations in this caae, to have an accurate result. Calculator Benchmark |
|||
09-04-2018, 12:52 PM
Post: #55
|
|||
|
|||
RE: CASIO Graph 90+E
(09-04-2018 11:50 AM)xerxes Wrote: After watching the mentiond video, I noticed that normally MicroPython compiles to bytecode, but there seems to be also a native code mode, Doesn't appear to be supported (or I'm doing something wrong). I get "invalid micropython decorator". |
|||
09-04-2018, 01:00 PM
Post: #56
|
|||
|
|||
RE: CASIO Graph 90+E
What a pity, but good to know.
Calculator Benchmark |
|||
09-04-2018, 01:59 PM
(This post was last modified: 09-04-2018 02:05 PM by gomefun2.)
Post: #57
|
|||
|
|||
RE: CASIO Graph 90+E
I'm not too familiar with how python libraries work. But I think the calculator can probably use custom made libraries.
I think to create a custom library, you would just create a .py file on a computer then put it in the same folder as your project on the calculator. Then you could call the file by using import. I'm not sure if you could do graphics this way, but I'm reasonably sure that other custom libraries could be created doing this. Anyway, because documentation is lacking (as far as I can tell), and because some people have inquired, here is a list of the libraries included on the calculator: Built-in (standard library): abs(), and, as, bin(), break, class, complex(,), continue, def, def:, def:return, del, divmod(,), elif, else, except, False, finally, float(), for, for:, for:range(), for:range(,), for:range(,,), from, global, hex(), if, if:, if:else, if:elif, if.and:else, if.or:else, import, in, input(), int(), is, lambda, len(), max(), min(), None, nonlocal, not, oct(), or, pass, pow(,), print, raise, range(), return, round(), sorted(), str(), sum(), True, try, type(), while, while:, with, yield, ().imag, ().real Math Library: acos(), asin(), atan(), atan2(,), ceil(), cos(), cosh(), exp(), fabs(), floor(), fmod(,), frexp(), from math import*, import math, ldexp(,), log(), log10(), math., math.e, math.pi, modf(), pow(,), sin(), sinh(), sqrt(), tan(), tanh() Random Library: choice(), from random import*, getrandbits(), import random, randint(,), random(), random., randrange(), seed(), uniform(,) Symbols: e, +, -,*,**,/,%,&,|,^,~,<,>,<=,>=,==,!,(,),[,],{,},,,:,.,;,=,',",#,\,!,_ |
|||
09-05-2018, 11:32 AM
Post: #58
|
|||
|
|||
RE: CASIO Graph 90+E
(09-04-2018 01:59 PM)gomefun2 Wrote: I'm not too familiar with how python libraries work. But I think the calculator can probably use custom made libraries. Yes, you can create modules this way, but they have to be pure Python code, i.e. you don't get any capabilities that aren't there already. It's more of an encapsulation and code sharing feature. |
|||
09-06-2018, 10:35 AM
(This post was last modified: 09-06-2018 11:34 AM by brickviking.)
Post: #59
|
|||
|
|||
RE: CASIO Graph 90+E
(09-01-2018 10:40 AM)xerxes Wrote: The CG20 needs 39.7 seconds with BASIC. Strangely using MAT is a bit faster than using a list. I've tried this on the older 9750GII (upgraded OS) and a 9750G+. I got 876 in about 45 seconds on the GII, but got a Syn Error at the IfEnd for the G+, and I don't know why yet, as it's the same code on both. Any clues? EDIT: Ah, I forgot to follow the initial hpmuseum link, I've found the G+ code differs from the GII code. However, I'd still like to know why the newer code doesn't work. I entered the code from the link for the G+, and it errors out on List 1[X]-List1[Y]->T (with Arg Error). (Post 275) Regards, BrickViking HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a) |
|||
09-06-2018, 11:53 AM
Post: #60
|
|||
|
|||
RE: CASIO Graph 90+E
There are different test codes for the Casio graphing calculators, because I noticed that the 8 bit devices are faster with unstructured code
using a list, while the 32 bit ones are faster with structured code using a matrix. I remember testing the structured code on the older devices, caused an abnormal behaviour. Deeper investigation of the problem showed, that the reason is a bug of the interpreter, but I don't remember the details exactly. Thanks for testing the FX-9750GII-2 (SH4a). Calculator Benchmark |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)