- Home /
Question is off-topic or not relevant
Inputing an Equation
I want to have it so that the user enters an equation into a GUI text box. Then the program takes the string equation and graphs the equation.
I already know how to graph the equation and creating a text box to gain the string input but I'm having trouble taking the string equation that the user imputed and then changing that to something I can work with. I would like to have the program be made in C#.
Depending on the equations you that you wish to support this could be complex. NCalc is an open source c# mathematical expressions evaluator, you may find it a handy reference or try to use it as a back end?
This is a non-Unity design question, and it is beyond the scope of a Unity Answers question. I'd start by Googling, "code parse formula." This link from that search seems to be a good starting point:
http://www.codeproject.com/Articles/752516/$$anonymous$$ath-Equation-Parsing-using-Call-Stacks
You're basically asking how to build a parser, as robertbu has said. It's a complicated topic, and if you want to get it to work well, you'll need to do a lot of studying.