I am trying to solve a mathematical problem that is in the form of this function:
f(x) = c1x1 + c2x2 + q1x12 + q2x1x2 + q3x22
Now I have created an interface where the user can input the values of c1, c2, q1, q2, and q3
Now what we need to solve this function are the values of x1 and x2 to be substituted in the equation. In other parts of the algorithm, the values of x1 and x2 usually ends up with something like x1 = (0 - 0.8ρ1) and x2 = (0 - 0.6ρ1)
Now assuming the user keyed in the values of c1, c2, q1, q2, and q3 as 0, 2, -1, 2 and -2 respectively, this will make the function to appear as:
f(x) = 0x1 + 2x2 + -1x12 + 2x1x2 + -2x22
This can be re-written as:
f(x) = 2x2 - 1x12 + 2x1x2 - 2x22
Now if we substitute x1 = (0 - 0.8ρ1) and x2 = (0 - 0.6ρ1) in the equation above we will have:
f(x) = 2(0 - 0.6ρ1) - 1(0 - 0.8ρ1)2 + 2(0 - 0.8ρ1)(0 - 0.6ρ1) - 2(0 - 0.6ρ1)2
As you can see if we solve further we will eventually find the value of ρ1
So the problem now is how can one write a program to solve this kind of problem and get the value of ρ1 in Java, or is there such a program already written? I've tried so many things already but can't come up with a solution.
Any help will be highly appreciated. Thanks
- Jevison