title: How to do arithmetic expression evaluation in prolog?
body: <p>I am trying to solve an arithmetic expression in prolog (implementation - eclipse prolog). The arithmetic expression to be solved is like this:</p>
  
  <pre><code>A * (C + B * X) + D * X = E
  </code></pre>
  
  <p>X is the value to be computed, and all others (A,B,C,D,E) are all numbers. </p>
  
  <p>For example: 5 * (3 + 2*X) + 2*X = 39, on computing should assign X with the value 2.</p>
  
  <p>The query(goal) that would be entered into Prolog would take the form:</p>
  
  <pre><code>?- compute( 5*(3+2*X)+2*X = 39, Result).
  </code></pre>
  
  <p>The 'Result' and value of 'X' should be tied (assigned) together.
  How do I write the prolog program to do this..?</p>
  
  <p>Thank You.</p>