Project 1: Extra credit

Due

You may earn extra credit by adding new functionality to your calculator. Extra credit will be factored into your final grade for this class.

The amount of extra credit you earn will vary depending on the complexity of the task and the quality of your work. More challenging tasks will earn more extra credit points.

If you want to try extending the calculator in a way that isn't listed in this doc, talk to the course instructor first. We will probably OK it as long as it's reasonable.

Ideas

  1. Add more math functions (easy)

    You were asked to only implement the sine and cosine math functions. Try extending your calculator to support more!

  2. Implement a solve function (medium to hard)

    Try writing a solve(...) function that solves for some user-specified variable. For example, solve(3 = x + 2, x) would return 1.

    Before implementing this, you will need to add support for the = math operator (which can be done similarly to how you added support for operators like + or *)

    Your solve function can either try and symbolically solve the equation, or try and approximate an answer (perhaps within a user-specified range).

  3. Implement a derive function (medium to hard)

    Try implementing a function that can take the derivative of some user-specified expression. Your derive function doesn't need to support arbitrary expressions: you could have it support only polynomials, for example. (If you support more types of expressions, that'll be more extra credit).

  4. Implement more plotting functions (easy to hard)

    Currently, we can only plot line plots. Try adding more plotting functions to draw different kinds of charts and visualizations!

    You should add a new method to the ImageDrawer class for each new plotting function you implement. Please do not change or modify any of the existing methods.

  5. Implement control flow (if statements, loops) (medium to hard)

    Try creating an if(cond, then, else) function. The function should first evaluate the cond expression and returns then if it evaluates to true and returns else otherwise.

    Since our expressions always evaluate to numbers, we'll treat 1 as being synonymous to true, and 0 as being synonymous to 'false'.

    Similarly, implement a loop(amount, body) function that repeatedly evalutes the body multiple times.