KhiCAS is a port of my Giac/Xcas computer algebra system (CAS) for the Casio CG50 or Graph90+e, it provides algebra, calculus, solvers, linear algebra, graphs, ... commands for highschool to University maths.

Documentation :

English

https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasioen.html
French

https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasio.html
Download :

English

https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasen.g3a
French

https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicas.g3a
It is licensed under the GPL2. Some interface code was borrowed from Eigenmath UI written by G. Maia, however KhiCAS is a far more complete CAS than Eigenmath.

Enjoy!

Welcome to Cemetech, parisse, and thank you for sharing this with us! Would you consider uploading KhiCAS to

the relevant folder in our Downloads section? I'm also curious what it adds on top of Eigenmath, given how much I've enjoyed

gbl08ma's port of Eigenmath to the Casio Prizm.

**KermMartian wrote:**

I planed do that in a couple of days, just to make sure there is nothing evident to fix (consider the current version as a release candidate).

As for what it can do w.r.t. Eigenmath, here is a non exhaustive list:

* limits

* asymptotic series expansion (Taylor expansion at infinity)

* much more antiderivatives: integrate works with algorithms, not with a table of integrals. Examples: integrate(1/(x^4-1)^2), integrate(sin(x)*exp(x)), integrate(exp(x^2)*(2x^2+1)), ...

* discrete symbolic sums like sum(k^2,k,1,n)

* solve equations, systems, differential equations, recurrences

* exact eigenvector/eigenvalues (vs numeric in Eigenmath)

* programming with Python-like syntax, including a step by step debugger

For example the Mandelbrot fractal

**Code:** ```
```

def FRA(X,Y,Nmax):

# local w,h,y,c,x,z,j

w=2.7/X

h=-1.87/Y

Y=Y-1

for y in range(ceiling(Y/2)+1):

c = -2.1+i*(h*y+0.935)

for x in range(X):

z = 0

for j in range(Nmax):

if abs(z=z**2+c)>2:

break

set_pixel(x,24+y,5100*j+512)

set_pixel(x,24+Y-y,5100*j+512)

c = c+w;

set_pixel() # synchronize screen

Then FRA(100,100,10) will display a small fractal picture (takes some time).
I have been 'playing' with KhiCas and it's true, it has lots of advantages compared to the official MicroPython of the Casio CG50/Graph 90+e, but KhiCas has still important bugs, like:

I cannot create a new file/program, it appears to be saved with no error messages but it is not created. The only thing I could do is to create a new program with the official Casio Python and then modify/save with KhiCas.

Also KhiCas freezed a couple of times, I had to do a reset of the calculator.

Other minor problems are there so, for now, I will continue using the Casio Python app with its limitations.

On the fx-CG50 / Graph 90+E, KhiCAS has to deal with the memory size limitations for a program (app), and the maximum size is relatively low. Bernard Parisse had to cut into the XCAS feature set, and allocate less memory at various places, which created some bugs.

I decided to do a factory reset on my CG50 after a few months installing programs to test, and I installed KhiCas again. The good news is now it saves the new files I create with it! So apparently everything is fine.

On the other hand, while testing Python commands I found some unexpected results in a few programs I wrote, but I need to test it further to check if there is something wrong with KhiCas or with the code I wrote.

Cheers!

Make sure to get the latest version of KhiCAS, I have fixed bugs recently.

More bugfixes and one important new feature : clock is now displayed in the shell and program editor.

Hi. Thanks for this modification of the Eigenmath port! Just wanted to thank you and to say that if you're not sure, it works, at least the basic things, on the CG20 - tried it now. I don't know if more advanced features work or not, but the basic I tried worked, so I'm just saying it can work at least some things on the CG20 for anyone interested in using it with the CG20. I'm thinking in replacing the original for this one, as this is so much more complete. Thanks again! This might help many people a lot!

This is excellent, are you going to upload the source code to a git repository?

It works great on my fx-CG50, thanks for your work on this.

Could you update the icon so that it better matches the white theme on the fx-CG50?

Thanks.

I have it installed on my CG50, but I am having some issues with it.

1. Opening any other application after I use KhiCas takes a really long time. It seems like almost a minute. From my understanding of the OS, applications are terminated not when the user switches to the main menu (which seems to be

handled by the keyboard handler) but when the user opens the next application. I have been told that the delay is because the application is very large, but Physium, which is almost as large, does not experience the issue. What could KhiCas have done to make it so hard to clean up? Or did I somehow break it?

EDIT: I determined that this issue is caused by me having a corrupted binary. So yes, I did somehow break it. (The fresh copy takes about 5 seconds to close, which is longer than any other app I have but actually reasonable.)

2. I can't seem to get the calculators clipboard to work in KhiCas. In "Xcas RAD session," I am completely unable to copy-paste because it seems like the copy button (shift+8) doubles as another paste button or something for some reason. I can copy-paste within "Xcas session - 1/1," but it seems to function independently of the rest of the calculator, so I can't copy something in, do some work on it, then copy it back out to use the native functionality again.

3 (not an issue, but I might as well put it here). Pressing "exit" alternates between two seemingly independent screens, one that says "Xcas RAD session" on the top and one that says "Xcas session - 1/1" on the top. They behave almost identically, except the first one has only black text and the function keys are algb, calc, view, cmds, A<>a, and File, and the second has color-coded text and the function keys are tests, loops, misc, cmds, A<>a, and File. There might also be more differences I haven't noticed, but what are those two different screens meant to be used for?

**ProgrammerNerd wrote:**

This is excellent, are you going to upload the source code to a git repository?

The source code is available from https://www-fourier.ujf-grenoble.fr/~parisse/casio/kupdate.tgz. For some details on how to compile, see https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasioen.html#sec26
**linux-user wrote:**

2. I can't seem to get the calculators clipboard to work in KhiCas. In "Xcas RAD session," I am completely unable to copy-paste because it seems like the copy button (shift+

doubles as another paste button or something for some reason. I can copy-paste within "Xcas session - 1/1," but it seems to function independently of the rest of the calculator, so I can't copy something in, do some work on it, then copy it back out to use the native functionality again.

Inside the shell, you can copy/paste an earlier command or answer to the commandline by pressing EXE when the level has been selected. CLIP/PASTE works in the programming editor, but only inside KhiCAS.

**Quote:**

3 (not an issue, but I might as well put it here). Pressing "exit" alternates between two seemingly independent screens, one that says "Xcas RAD session" on the top and one that says "Xcas session - 1/1" on the top. They behave almost identically, except the first one has only black text and the function keys are algb, calc, view, cmds, A<>a, and File, and the second has color-coded text and the function keys are tests, loops, misc, cmds, A<>a, and File. There might also be more differences I haven't noticed, but what are those two different screens meant to be used for?

One screen is the shell, the second one is the programming editor (this one has syntax color and some other editing features). Documentation is available here: https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasioen.html
I get it now. Is there an intentional reason why I can only clip/paste inside of KhiCAS, or is it just something you haven't gotten around to implementing? Are there any workarounds other than memorizing and retyping?

I haven't looked how it could interact with the system, because I did not think it would be useful, KhiCAS is like an alternate calculator, you can do a lot of things inside: numeric computations, CAS, programming and plots.

Thanks for clarifying that. Because you said in the main post that it is a CAS system, I for some reason thought it was purely CAS and not much else. After playing with it for a bit, I realized that it is a lot more than that. However, I still honestly find Casio's UI much easier to use. I think integration with the system clipboard would be nice because it would allow people to use Casio's easier UI for most things and KhiCAS when they want a little more capability. A few more questions:

1. If I launch something that freezes my calculator such as plot(Y,xY*sin(xY),x=-20..20), is there any way to stop it other than the reset button? Casio's apps let me press AC/on to interrupt a computation. (I believe that key is wired to a CPU interrupt pin, if it will help in any way) BTW, that graph even overloads Desmos and GeoGebra on my laptop, so I was not expecting it to be fast on my calculator.

2. Your graphing is SO MUCH FASTER than Casio's built in graphing. Is it simply because you only draw when you are done with the math and then don't redo all of it every time I zoom and scroll, or do you have even more optimization? And why would Casio make their built-in graphing so inefficient if there is potential to be much faster?

3. Is there a way to have it automatically re-render my graph if I scroll beyond the minimum and maximum x or zoom in to a level where less than 384 points are in view, or will I just have to find out in advance how much of a graph I need?

You will always find it harder to learn a UI if you are accustomized to another UI. It would be different if you learn KhiCAS first.

1/ I really don't understand what you want to plot with a command like plot(Y,xY*sin(xY),x=-20..20).

plot(x*sin(x),x=-20..20) is valid, but what's this Y? Also don't forget that there is no implicit multiplication in KhiCAS because variable names may contain several letters.

Normally AC/ON will interrupt a computation.

2/ Inside KhiCAS, if you run a plot, the computation is done once (with one discretization). It is not done again whatever you do with move/zoom.

3/ Sorry, I don't understand, can you give an example?

I think KhiCAS vs Casio is like CLI vs GUI. Your system is more powerful and easier to write scripts for, but Casio's UI is easier for most users to learn. They both have their place. But yeah, it would probably be easier if I learned KhiCAS first.

1. y=xy*sin(xy) simplifies to y=asin(1/x)/x, but this causes a bunch of missing solutions (values in the original that are not in the simplified version). The original looks really cool if you graph it on Desmos and Geogebra. I looked at the documentation again and it turns out that I misread something and got the idea that I could choose which variable represents the y value and then use that in the equation in addition to x. I think I misinterpreted a mention of f(x) in the documentation, so that's my mistake. (Just so you know, I was trying to plot this:

https://imgur.com/a/6JWSA9s.) Not surprisingly, I froze my calculator when I tried plot(Y,xY,x) which was an invalid command for the same reason. I was hoping to plot x=1 with that to prove that the syntax was valid, but it didn't work because user error. And AC/On did not interrupt that either. I had to use the restart button.

2. So you divide the graph into 384 points (or more if I ask for more) and do all of the computation once. This explains why there is no delay on move/zoom, but it does not explain how your initial drawing is faster than Casio's initial drawing. I think it's because you do all the math and then draw the entire graph at once, while Casio alternates between math and drawing. Is this right? If so, why would Casio make their graphing app so inefficient?

3. If I make a graph such as plot(sin(x)), it will fill the entire screen with the graph, but if I move beyond the initial screen, the rest of the graph is not drawn. If I plot something like plot(sin(x),x=-500..500), the graph looks fine at first, but has really low resolution if I zoom in. I can't figure out a way to fix either without exiting and drawing an entirely new graph. Here are the screenshots I took:

https://imgur.com/a/T4B2TVY
KhiCAS is clearly CLI-oriented but there are some powerful GUI additions, like the expression editor, or the programming editor, or the interactive program debugger. There is a learning curve if you want to master it, but you can do simple tasks without learning all the tricks (I mean all what it's in F1 algb and F2 calc menu).

1. corresponds to the Xcas command implicitplot. Well it would be implicitplot if you wrote it like this y=x*y*sin(x*y). Unfortunately, addins are restricted to 2M, there was no room for porting implicitplot from Xcas to KhiCAS. But plotcontour is available: F4 (cmds), 7 (Graphs), 6 (plotcontour), press F6 for help and F2 for an example.

On your example, it is however not adapted. It's better to run the command

plot(asin(1/x)/x);line(y=0)

2. and 3. When you run a plot command like plot(sin(x)), default values are used for the discretization, xmin=-5, xmax=+5, and xstep is set so that you have about one evaluation per horizontal pixel. After that a polygonal line is drawn (with some checks to avoid singularities). I don't know what Casio does. There are several optimizations in KhiCAS to get the computation fast, perhaps Casio code is not optimized like KhiCAS, but other explanations could apply, perhaps they compute more than 1 point per horizontal pixel.

This computation is done once, if you change the window/zoom, you will only have this polygonal line drawn. If you need to zoom, use a smaller xstep value, or set xmin and xmax, for example plot(sin(x),x=-3..3,xstep=1e-2) will compute 601 points.

I have updated the addin, AC/ON will now interrupt the plot command,

https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasen.g3a