Search for the only unknown in the equation

I need a library to be able to analyze the equation and give me a result that gives input.

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 evaluated by: 6/5

Is there any library for java that can do this for me? Basically, I need a program to isolate one unknown variable in an arbitrary equation ...

Thank you Thomas

+6
source share
4 answers

What you are looking for is a computer algebra system.

Wikipedia lists some options. I would take a look at the Java Algebra System

+1
source

For this you need a Java expression library. 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

+1
source
0
source

Not sure if you will find one that will be easy to use, but http://jscl-meditor.sourceforge.net/#mozTocId312653 seems to provide a solution to the polynomials: let me know that this works for you (and how! )

Alternatively, JScience can do what you want.

0
source

Source: https://habr.com/ru/post/891266/


All Articles