Converting a math expression (String) to usable variables
-
24-02-2021 - |
Question
I am trying to make an iPhone-app that does the Monte Carlo simulation on equations given by the user. I want the user to be able to input something like: "2x+(y^2)" and then recieve a result.
Is there a way to parse this string and get usable variables that i can do calculations on (a library u know of perhaps)?
Solution
Take a look on compiler tools. although it might be a bit bloated, it is easy to write any "language" in it even if its just for simple mathematical expressions.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow