I'd like to build myself a small app to get my homework done faster. I want the user to be able to enter any function like f(x)=x2-5x+3 or f(x)=x3/(2x-2) and then return a list of y-values for specific x-values. For f(x)=x2 it would look something like this:
- x=-2 y=4
- x=-1 y=1
- x=0 y=0
- x=1 y=1
- x=2 y=4
- x=3 y=9
- x=4 y=16
And so on. Is there any function in the math class of java that takes in a mathematical function and an x-value and outputs the according y-value or do I need to have some kind of parser of my own?
Edit
exp4j seems to be the right thing for me. This library is very small, fast and easy to use.