How would someone implement mathematical formulae in Java?
What I mean, the user inputs a string with multiple variables. Like a simple quadratic formula: x^2 + 5x + 10. Or in Java: (Math.pow(x,2)) + (x * 5) + 10. The user would then enter that and then the program would solve for x. I will be using the BeanShell Interpreter class to interpret the string as an equation. But how would I solve for x?
^in Java is not exponentiation. See stackoverflow.com/questions/1991380/…x^2 + 5x + 10for some value ofx? Or are you trying to solve an equation? If you're solving an equation, which one? You haven't given any equations. Are you trying to solvex^2 + 5x + 10 = 0? If so, there are some nice methods you can implement, that'll often work, that I can help with, that don't need anything like an algebra package.