Program Overview
- Well... it is a small program that is very simple in principle but a real pain to implement. It runs on a CASIO calculator, to simplify the complicated calculations in computational methods exams. You can enter the problem data and it directly outputs the process and the answer;
- Of course, you can also just type out formulas directly, such as those hard-to-remember finite difference schemes and iteration schemes; you just need to write a few more output statements;
- For now, it only implements Jacobi and Gauss_Seidel iteration, Gaussian elimination, and LU decomposition. Other problem types will be added gradually later;
- Feel free to try it. Honestly, I wrote this mainly to express a bit of disdain for this year's exam problems—damn, that LU decomposition had me hammering on the calculator for ages!!!
Demo
- Below are the outputs for Gaussian elimination and LU decomposition:


How to Use
- This program is an Add-in plugin. The official installation method is provided; see here.
- Of course, first you need a CASIO calculator. The model is FX-9860GII, which you can find here.
- If, like me, you cannot afford it, click here or here to download the SDK and emulator to try it first (the second link is the Casio official site, but it seems to require a VPN/proxy).
- Finally, the code and the compiled program (CALC.G1A) are on GitHub; click here. If you want to patch and compile my crappy code yourself, you also need to refer to here.
Unofficial Rant (No Responsibility)
- The original intent of writing this little thing was to simplify the meaningless calculations in computational methods exams.
- For example, in that annoying final exam, for the LU decomposition part I first used the calculator's built-in solving function. But once I saw the solution, it was obviously not the kind of thing that is easy to compute, and I ended up punching the calculator for ages.
- But as I kept writing, I found the real difficulty was far greater than expected. The nasty parts were mainly these:
- The IO-related functions in the SDK provided by CASIO are way too low-level. There is simply no C
printf,scanf, etc., and the output function they provide is basically the kind where you must specify a screen position and then print a single character. - As for keyboard input? Yeah right. It is about the same as handling keyboard interrupts directly in assembly. And it was only when I started testing that I realized I had forgotten to implement negative-number input... sigh.
- Even worse: the compiler bundled with the SDK clearly supports C++, but for some reason they just do not let you use it. Fortunately this is not completely unsolvable; it just means you must manually run a script for each build and cannot build from the IDE, because the IDE insists on overwriting the makefile every time.
- Another fairly nasty part is that C++ function overloading is not allowed. You can barely rationalize it as an embedded-system performance consideration; otherwise that whole set of matching rules would be a non-trivial overhead.
- One particularly bizarre thing: the compiler does not even report an error when the code references an undefined variable. It is basically the end of the world for clumsy people like me—random typos causing all kinds of bizarre bugs...
- The IO-related functions in the SDK provided by CASIO are way too low-level. There is simply no C
- So I wrote a whole set of IO functions myself—essentially a preliminary implementation of C++ iostream on the calculator. It is rough, but usable. Earlier I also implemented a fraction arithmetic library; this one is even rougher. It does not handle any exceptions such as overflow, and I did not even overload the input operator for it.
- Then I discovered these people did not expose any interface for parsing arithmetic expressions. In other words, expression parsing has to be written from scratch. While doing this in C++ is just a matter of time and carefulness, if I re-implemented all of that myself, it would be little different from developing the calculator's upper-layer firmware—so I gave up decisively.
-
In the end, using only the existing functionality, the computationally tedious exam problems that can be handled are basically only the following:
- Newton interpolation
- Hermite interpolation
- Romberg integration
- LU decomposition and Gaussian elimination
- Jacobi, Gauss, SOR iterations, etc.
-
Rewriting all of these and making the output concise and nice-looking on such a small screen is just too much trouble. Also, I have been tight on time recently, so I will stop here for now. I only rewrote a few simple elimination and iteration algorithms, and will improve it later when I have time.
-
But actually, now that IO is basically complete, outputting the process is not really hard. It is nothing more than adding a few more
coutlines inside loops. -
Finally, feel free to rant.