I want to process this polynomial
String str = "2*x^2 + x + 2*x^2 + 8 - x^3";
I have split the string with plus and minus operator and got the 2*x^2. I am finding it difficult to work out this operation.
I know first i will need to work out value of x lets say x=2, just don't know how can I parse string to integer as there are other parts of the string to be parsed as well.
do i need to decompose "2*x^2" too?
How do I find * in string. I know i can use str.contains("*"), for this purticular operation i know whats coming after 2*x^2 but if user enters the polynomial thats the tricky bit.
Output is so far
Operation 2*x^2 + x + 2*x^2 + 8 - x^3
Plus Splits
0 2*x^2
1 x
2 2*x^2
3 8 - x^3
Minus Splits
0 2*x^2 + x + 2*x^2 + 8
1 x^3
Try to use this: http://projects.congrace.de/exp4j/