Requirements:
operators supported: ( ) * / + - ^trigonometric functions: sine, cosine, tangent, cotangent, secant, cosecant
variables from set of a - z, A - Z, 0 - 9, and _ of arbitrary length
- must parse "code-like input" and create tokens from it
- must build a syntax tree using PEMDAS (http://www.purplemath.com/modules/orderops.htm) order of operations. Feel free to use code from http://castingrays.blogspot.com/2014/10/mathematical-expression-parsing-and.html for reference
- Ability to store variables, and variables must be usable in equations
- Numeric values supported is the set of ints and doubles
- Ability to support user-defined and evaluation of functionsExample: the user inputs “defn square(x) = x * x”square(5) returns 25
- Support for basic graphing: e.g. graph( 3 * X ^ 2 + 7)
- Support for trigonometric functions (implemented in the code – do not reference trig functions of the standard library). e.g. sin(30) outputs 0.5
- Please include meaningful/informative comments
Additional examples:
takes in arithmetic expressions of arbitrary length in standard infix notation (e.g. 7 + 8 * 9) and returns the result (output in this example 79)assignment to variables (e.g. b = 7 + 8 * 9 would assign the value of 79 to variable b)
evaluation with variables (e.g. c = 5 * b would assign 395 to c)
Comments
Post a Comment