Solving equations having a single variable
How can I programmatically solve following equations:
1. y=mx+c
2. x^2+z^3=a+b
3. (a+7)^2=3x+4y
4. a+3=1
The values for all the variables will be given by the user except one
unknown which needs to be calculated programmatically. For example for
equation 1 y=3 , m=5 and c=6 then equation becomes:
3=5x+6.
using variations of the same formula like c=y-mx to calculate the value of
c will not work for me as users will also be able to give in their own
formulas for calculation. I tried to push the equation into stack check
for parenthesis and execute the operators but it doesnot work if formulas
are not modified according to the quantity being calculated.
My choice of language is java but any help is much appreciated. Thanks in
advance.
No comments:
Post a Comment