I am using DDMathParser to parse the string expressions. I am working on one expression which is "(2+x)6+2x+2y=5y+2x", I am trying to parse it and evaluate it using DDMathParser. It can be considered as first degree function that I need to solve using Objective C.
Guys any ideas?
Help would be highly appreciated.
DDExpression * e = [DDExpression expressionFromString:expression error:error];
NSNumber *num = [e evaluateWithSubstitutions:substitutions evaluator:nil error:error];
I don't know much about
DDMathParser(OK, I don't know anything about it), but taking a look at the documentation gives some clues about what is going wrong with your code.Based on the documentation, I could find not example of where
DDMathParsercould handle symbolic expressions. All of the examples on the Usage page show numeric expressions.For symbolic math, see Symbolic Math Library in C/C++/Obj-C .
In addition, it looks like you are trying to solve for two variables with a single equation, which is certainly not going to result in a numeric solution.
However, if you are just trying to substitute values in for
xandy, you should use the$sign before them as the documentation says:So if you just want to substitute values in your expression, try using:
Then fill in with values.
And evaluate.