01Background
I needed a graphing calculator to do computer graphics for 3D software. Existing free graphing calculators were either 2D or only supported known function families. I wanted to visualise arbitrary mathematical expressions. The main challenge was writing a mathematical expression parser and evaluator from first principles, which I would have control over. For the graphing element I used a graphics library which I had written previously.
02Details
I lost the report document as well as most likely the entire repository. I’m currently working on finding it… Essentially I made a class structure of different mathematical objects, such that an expression would be a tree of these objects. The trees would have a standardised form which I formalised in a separate class structure, allowing me to write rules on operation precedence. I could then forward-propagate variable values in the tree to evaluate expressions.
03Outcome
The graphing calculator could evaluate any expression made with the buttons I presented, including trigonometric and calculus functions. I was not able to complete the integration laws of the trigonometric functions before the project deadline, and would have had to create a bank of theorems and results if I were to continue. The program ran smoothly with resolution determined by zoom.