title: Python minimization leastsq with columns
body: <p>Please excuse me but I started recently using Python...and code.
  I have some troubles with optimization in python...
  I would like to determine coefficients k0,k1...of a polynom defined in residual_x with data of vector "T" for each column of 2D array "test" (as example here with 3 columns), is it possible? and store results as 2D array.</p>
  
  <p>As you can see, I do for only a list of data.</p>
  
  <p>Thanks a lot for help!!!</p>
  
  <pre><code>import numpy as np
  import scipy
  import pylab 
  from scipy.optimize import leastsq
  
  T = np.arange(5,56,5)
  T = np.reshape(T,(11,1))
  
  test = np.array([[  3051.11,   2984.85,   3059.17],
         [  3510.78,   3442.43,   3520.7 ],
         [  4045.91,   3975.03,   4058.15],
         [  4646.37,   4575.01,   4662.29],
         [  5322.75,   5249.33,   5342.1 ],
         [  6102.73,   6025.72,   6127.86],
         [  6985.96,   6906.81,   7018.22],
         [  7979.81,   7901.04,   8021.  ],
         [  9107.18,   9021.98,   9156.44],
         [ 10364.26,  10277.02,  10423.1 ],
         [ 11776.65,  11682.76,  11843.18]])
  
  k0 = 100.
  k1 = 100.
  k2 = 1.
  k3 = 1.
  k4 = 1.
  k5 = 10.
  
  def residual_x(vars, T, donnees):
      k0 = vars[0]
      k1 = vars[1]
      k2 = vars[2]
      k3 = vars[3]
      k4 = vars[4]
      k5 = vars[5]
      modele = T**5*k0+T**4*k1+T**3*k2+T**2*k3+T*k4+k5
      return (donnees-modele)
  
  vars = [k0, k1, k2, k3, k4, k5]
  out_x = leastsq(residual_x, vars, args=(T, test),epsfcn=0.001)
  </code></pre>