I have to find parser for solving equation with unknows. User enters two numbers and the parser parses equation to solve. For example:
Equation: x^3 + y^2 + sin60°
User input: x=4, y=2
It have to be done using AForge.NET framework. Console app/WinForms
I have been looking for it in AForge .NET documentation but can't find something matches my problem.
I don't believe there is an evaluator for regular mathematical expressions in AForge, but you could use the PolishExpression class to evaluate an expression written in reverse polish notation:
This yields the value 68.86602540378443. There's also no direct exponential operator, so I just multiplied x by itself three times. But you could use logaritms instead:
You can also confirm that this is the same as you'd get in C# (note that you must convert 60 degrees to radians in order to use Math.sin):
But yeah, I'd recommend using another library if you don't want to use polish notation in your expressions.
I also tried the code example above with "AForge.Math.Expression", but I don't believe this class exists in AForge.Math 2.2.5.