A fully functional graphing calculator! The buttons are (from left to right): •Set Function: Asks you for a function, then graphs it. •Set Zoom: Asks you for a zoom factor, then zooms in or out. For example, entering "2" will zoom out by a factor of 2, whereas "0.5" will zoom in by a factor of 2. •Pan Window: Click on one of the arrowheads to pan the window in that direction. •Show/Hide Window Bounds: Enables or disables showing the window bounds. Entering a function: The calculator supports the following symbols: + - * / ^ ( ) Note that a "*" symbol must be present for multiplication, so to enter 2x, you must write 2*x. Also, directly entering negative numbers does not work. To enter -x, you must write 0-x. Additionally, it also supports numerous functions: abs(), floor(), ceiling(), sqrt(), sin(), cos(), tan(), asin(), acos(), atan(), sindeg(), cosdeg(), tandeg(), asindeg(), acosdeg(), atandeg(), ln(), log() Note that the calculator will use radians unless specified otherwise. For example, sin(x) assumes x is in radians, whereas sindeg(x) assumes x is in degrees.
How does it work? ☆~Magic!~☆ Just kidding, it's actually just math :) One major challenge I found for parsing the input to a graph was converting the expression into Reverse Polish Notation (RPN). For this, I made the program run a Shunting-yard Algorithm (https://en.wikipedia.org/wiki/Shunting-yard_algorithm). I also had some difficulties properly implementing exponents of negative numbers, which I was able to eventually solve, albeit with much difficulty (look for the "[]^[]" block in the "parser" sprite to see how I did it, I needed to use several workarounds).