I’ve been asked many times how does KAlgebra work. It’s not difficult, but I’ll explain it in different posts to make it a bit lighter to read.
KAlgebra is a KDE-based calculator with graph capabilities based on MathML 2.0 Content Markup. If you want to learn a bit more about KAlgebra, you can go to the berlios.de or kde-apps KAlgebra’s website. There you’ll find some information, commentaries, packages and stuff.
Today I’ll talk about calculus, which are the KAlgebra’s core, since it is a calculator… The calculus in KAlgebra by now are made the DOM tree in a module called Analitza, and mathematical expression is translated into MathML by the QExp module. So the calculus goes like this.
If we enter a MathML expression:
MathML -> Analitza -> Result
And if we enter a Mathematical expression:
Expression -> QExp -> Analitza -> Result
This is the whole thing, I don’t think it is complicated. In the case of graphs, is a bit different, because obviously the QExp pass is done only the first time, so the thing goes like this:
I think it can be understood explained like this, it’s not complicated at all.
I’ve got some new ideas for it for the near future. I want it to become an algebra-capable engine, and I want it to be a bit faster. My idea is to build my own trees instead of using the QDom tree. That could make it much more faster because the main penalty it has by now is that values have to be converted from text to double in every calculus. That’s very important for graphs because they’re calculating everything many times (2D graphs make up to 832 calcs for 1 graph in the Standard resolution, and arround 6200 calcs for a simple 3D graph) and we shouldn’t be repeating code that could be calculated only once. The other important thing, is that operators won’t be in text too, so lots of strcmp is going to be saved.
The main reason for the change is not a performance reason, the main reason is that with my own trees will be MUCH more easy to work with it so I’ll can have the simplify capability (which is very important, for differentiation at least), I’ll make it capable to have different memory types so we can work with sets, polynomials, unreal numbers, rational numbers, boolean (which are supported nowadays in a strange way) and whatever we want, always over MathML, of course.
I hope it hasn’t been very boring, bye!