title: solve an n-dimensional optimisation problem using iminuit
body: <p>I woul like to solve an n-dimensional optimisation problem using iminuit.</p>
  
  <p>So my approach is the following.
  I am trying to figure out how to extend this: </p>
  
  <pre><code>def f(x,y,z):
      return (x-1.)**2 + (y-2*x)**2 + (z-3.*x)**2 -1.
  </code></pre>
  
  <p>to a variable "x" that is a numpy.array.</p>
  
  <p>I would like to do something like this:</p>
  
  <pre><code>x = [1,2,3,4,5]
  y = [2,4,6,8,10]# y=2x
  class StraightLineChi2:
      def __init__(self,x,y):
          self.x = x
          self.y = y
      def __call__(self,m,c): #lets try to find slope and intercept
          chi2 = sum((y - m*x+c)**2 for x,y in zip(self.x,self.y))
          return chi2
  </code></pre>
  
  <p>but in my case x is my unknown, and it is an array. Like in many optimization/minimization problems, the function is a f=f(x1,...,xn) where n can be big. x1,...,xn are the unknowns of the problem.</p>
  
  <p>(These examples are taken from <a href="http://nbviewer.ipython.org/urls/raw.github.com/iminuit/iminuit/master/tutorial/tutorial.ipynb" rel="nofollow noreferrer">here</a>)</p>
  
  <p>Something similar is achieved "hacking" pyminuit2, like described <a href="http://code.google.com/p/pyminuit/issues/detail?id=6" rel="nofollow noreferrer">here</a></p>