title: Implementation of Poincaré–Miranda theorem
body: <p>To test whether a continuous function has <strike>a root</strike> one simple root in a given interval [x0, x1] is relatively easy: according to <a href="https://en.wikipedia.org/wiki/Intermediate_value_theorem" rel="nofollow">Intermediate value theorem</a> when the sign of function value at x0 is opposite to the sign at x1, there is (at least) one root.</p>
  
  <p>For example, given a quadratic function:</p>
  
  <pre><code>g(x): a*x**2 + b*x + c = 0
  </code></pre>
  
  <p>The test looks like:</p>
  
  <pre><code>if sign of g(x0) is opposite of sign of g(x1)
  then return true
  else return false
  </code></pre>
  
  <p>For multivariate case there is <a href="https://en.wikipedia.org/wiki/Poincar%C3%A9%E2%80%93Miranda_theorem" rel="nofollow">Poincaré–Miranda theorem</a> but I have a bit of difficulty to implement the test correctly from reading the linked article.</p>
  
  <p>Given two quadratic bivariate functions:</p>
  
  <pre><code>g1(x, y): a1*x**2 + b1*y**2 + c1*x*y + d1*x + e1*y + f1 = 0
  g2(x, y): a2*x**2 + b2*y**2 + c2*x*y + d2*x + e2*y + f2 = 0
  </code></pre>
  
  <p>and a rectangular region [x0, x1] x [y0, y1], how to check if there is at least one root in the region?</p>
  
  <p>I mean, I assume the test should look somewhat like (this doesn't work):</p>
  
  <pre><code>if (sign of g1(x0, y0) is opposite of sign of g1(x1, y0) and
      sign of g1(x0, y1) is opposite of sign of g1(x0, y1) and
      sign of g2(x0, y0) is opposite of sign of g2(x1, y0) and
      sign of g2(x0, y1) is opposite of sign of g2(x0, y1))
  then return true
  else return false
  </code></pre>
  
  <p>Please, does anyone know what pairs of functions, interval end-points, and logical operators to check and in what order?</p>