title: How to find the value of an unknown mathematical variable in a function Using Java
body: <p>I am trying to solve a mathematical problem that is in the form of this function:</p>
  
  <p>f(x) = c<sub>1</sub>x<sub>1</sub> + c<sub>2</sub>x<sub>2</sub> + q<sub>1</sub>x<sub>1</sub><sup>2</sup> + q<sub>2</sub>x<sub>1</sub>x<sub>2</sub> + q<sub>3</sub>x<sub>2</sub><sup>2</sup></p>
  
  <p>Now I have created an interface where the user can input the values of c<sub>1</sub>, c<sub>2</sub>, q<sub>1</sub>, q<sub>2</sub>, and q<sub>3</sub></p>
  
  <p>Now what we need to solve this function are the values of x<sub>1</sub> and x<sub>2</sub> to be substituted in the equation.
  In other parts of the algorithm, the values of x<sub>1</sub> and x<sub>2</sub> usually ends up with something like x<sub>1</sub> = (0 - 0.8&rho;<sub>1</sub>) and x<sub>2</sub> = (0 - 0.6&rho;<sub>1</sub>) </p>
  
  <p>Now assuming the user keyed in the values of c<sub>1</sub>, c<sub>2</sub>, q<sub>1</sub>, q<sub>2</sub>, and q<sub>3</sub> as 0, 2, -1, 2 and -2 respectively, this will make the function to appear as:</p>
  
  <p>f(x) = 0x<sub>1</sub> + 2x<sub>2</sub> + -1x<sub>1</sub><sup>2</sup> + 2x<sub>1</sub>x<sub>2</sub> + -2x<sub>2</sub><sup>2</sup></p>
  
  <p>This can be re-written as:</p>
  
  <p>f(x) = 2x<sub>2</sub> - 1x<sub>1</sub><sup>2</sup> + 2x<sub>1</sub>x<sub>2</sub> - 2x<sub>2</sub><sup>2</sup></p>
  
  <p>Now if we substitute x<sub>1</sub> = (0 - 0.8&rho;<sub>1</sub>) and x<sub>2</sub> = (0 - 0.6&rho;<sub>1</sub>) in the equation above we will have:</p>
  
  <p>f(x) = 2(0 - 0.6&rho;<sub>1</sub>) - 1(0 - 0.8&rho;<sub>1</sub>)<sup>2</sup> + 2(0 - 0.8&rho;<sub>1</sub>)(0 - 0.6&rho;<sub>1</sub>) - 2(0 - 0.6&rho;<sub>1</sub>)<sup>2</sup></p>
  
  <p>As you can see if we solve further we will eventually find the value of &rho;<sub>1</sub></p>
  
  <p>So the problem now is how can one write a program to solve this kind of problem and get the value of &rho;<sub>1</sub>
   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.</p>
  
  <p>Any help will be highly appreciated. Thanks</p>
  
  <ul>
  <li>Jevison</li>
  </ul>