title: root minuit2 contours with parameter limits
body: <p>I'm trying to produce contour plots for parameters with physical limits using the Minuit2 minimizer which is a part of the <a href="http://root.cern.ch/drupal/" rel="nofollow">ROOT</a> data analysis framework. Unfortunately, Minuit2 seems intent on drifting the parameters into regions outside of their limits when I try to produce contour plots:</p>
  
  <pre><code>&gt;&gt;&gt; from minuit2 import Minuit2
  &gt;&gt;&gt; def f(x,y):
  ...     if x &lt; 0 or y &lt; 0:
  ...             print 'x = %.2f, y = %.2f' % (x,y)
  ...             raise Exception
  ...     return x**2 + y**2
  ... 
  &gt;&gt;&gt; m = Minuit2(f)
  &gt;&gt;&gt; m.limits['x'] = 0, 10
  &gt;&gt;&gt; m.limits['y'] = 0, 10
  &gt;&gt;&gt; m.migrad()
  &gt;&gt;&gt; xy = m.contour('x','y',3)
  Info in &lt;Minuit2&gt;: MnMinos UP value has changed, need to update FunctionMinimum class
  x = -9.95, y = 0.00
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "&lt;stdin&gt;", line 4, in f
  Exception
  </code></pre>
  
  <p>Has anybody else dealt with this or a similar problem? Are there any workarounds?</p>
  
  <p>I've already asked this question on the <a href="http://root.cern.ch/phpBB3/viewtopic.php?f=3&amp;t=15023&amp;sid=463c7f827b418610e211e6caa3741717" rel="nofollow">ROOT forums</a>, but I thought there might also be some stack overflow users who have dealt with this or a similar issue.</p>