I need a library to be able to parse an equation an give me the result giving the inputs.
For example something like this:
String equation = "5 = 6 / z";
EquationSolver solver = new EquationSolver(equation);
double result = solver.getResult();
System.out.println("result: " + result);
And evaluates to: 6/5
Is there any kind of library for java that can do that for me? Basically I need the program to isolate the single unknown variable in an arbitrary equation...
Thanks Thomas
In calculating a proportion, we need to identify the ratio with the known values and the ratio with one known and one unknown value, making sure the comparative values are in the same places in the ratio. We then use cross multiplication to solve for the unknown.
The linear equations in one variable is an equation which is expressed in the form of ax+b = 0, where a and b are two integers, and x is a variable and has only one solution. For example, 2x+3=8 is a linear equation having a single variable in it.
What you're looking for is a computer algebra system.
Wikipedia lists some options. I would check out Java Algebra System
You need a Java expression Library for this. I found MVEL to be a good Java Expression Library
You can check this link for other java expression libraries. http://java-source.net/open-source/expression-languages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With