title: How to properly define vector function for scipy's curve_fit
body: <p>I have a problem of how python evaluates vector functions of the form (f1(x),f2(x)) for arrays of x when trying curve fitting.</p>
  
  <pre><code>import numpy as np
  from scipy.optimize import curve_fit
  
  def func(x,a,b,c):
      return np.array([a*x**b+c,a*x**b+c+1])
  
  ydata = np.array([[1,2],[3,4],[5,6],[7,8]],dtype=float)
  xdata=np.array([1,2,3,4], dtype=float)
  popt,pcov = curve_fit(func, xdata, ydata)
  </code></pre>
  
  <p>gives "ValueError: operands could not be broadcast together with shapes (2,4) (4,2)"
  Transposing the data to be fitted:</p>
  
  <pre><code>ydata=np.array([[1,2],[3,4],[5,6],[7,8]],dtype=float).transpose()
  </code></pre>
  
  <p>gives "TypeError: Improper input: N=3 must not exceed M=2", because now I have less function values than parameters. Ok, I know why I can't make a fit for that. So I need to transpose the function values:</p>
  
  <pre><code>def func(x,a,b,c):
      return np.array([a*x**b+c,a*x**b+c+1]).transpose()
  </code></pre>
  
  <p>This gives me "Result from function call is not a proper array of floats."</p>
  
  <p>How do I get a solution from such a problem? Mathematically, it should be well determined, if the data can fit the model.</p>