Alright. Resident moderator Alex Vincent has been after a "toMathML()" method for a while now it seems. So I told him, "Alright, no biggie." . Now I gotta deliver.
Content MathML 2.0 is essentially Polish Notation, but in XML. You can directly convert infix expressions (Algebraic notation) to prefix (Polish), however I decided to take a different route and implemented my own algorithm for directly converting an infix expression into an expression tree. And from the tree, I can dynamically evaluate it recursively, pre-order traverse it, post-order traverse it, in-order traverse it, and generate MathML like nothing.
So, if you're using Mozilla, check it out here:
The algorithm works fine in any JS-capable browser, however I use DOM2 namespaced node-creation methods that only Mozilla supports for MathML generation. Presentation MathML output will come as soon as I hook up the XSLT stylesheet. Also, support for unary operators and functions (like sin, cos, log), etc will come as soon as I replace the binary tree data structure with an n-ary tree data structure.
You can try this simple example to type in the algebraic input box:
y = 5*x + 2
Oh, and I noticed that I didn't explain the reason why I included "symbolic" in the title... by creating an expression tree, it becomes trivial to perform operations symbolically on it. Differentiation of an expression tree, for example, is exceedingly easy.
Alright - to please Mr. Vincent, here is a zip with everything: