0

I am creating a graphing calculator and I need to figure out how to get the function the user wants. You know how on Desmos, they take the function the user enters and graphs it? I do not know how to take the input of lets say for example: ((x^3)+1)/6x and understand what the user just entered.

It would look something like this: function = input('f(x) = ')

I need it to handle users putting in stuff like sqrt() and other things for graphing as well. Thanks

1 Answers1

0

Copying this post's answers:

A pretty good approach would involve two steps. The first step involves converting the expression from infix to postfix (e.g. via Dijkstra's shunting yard) notation. Once that's done, it's pretty trivial to write a postfix evaluator.

Krish
  • 1,044
  • 9
  • 20