title: fsolve - mismatch between input and output
body: <p>I'm trying to solve an overdetmined system of equations with three unknowns. I'm able to get solution with fsolve and lsqnonlin in MATLAB by calling the system of equations through a for loop.</p>
  
  <p>But in python using scipy, I'm getting the following error message:</p>
  
  <pre><code>fsolve: there is a mismatch between the input and output shape of the 'func' argument 'fnz'
  </code></pre>
  
  <p>The code is given below:</p>
  
  <pre><code>from xlrd import open_workbook
  import numpy as np
  from scipy import optimize
  g = [0.5,1,1.5]
  wb = open_workbook('EThetaValuesA.xlsx')
  sheet=wb.sheet_by_index(0)
  y=sheet.col_values(0,1)
  t1=sheet.col_values(1,1)
  t2=sheet.col_values(2,1)
  t3=sheet.col_values(3,1)
  
  def fnz(g):
      i=0
      sol=[0 for i in range(len(t1))]
      x1 = g[0]
      x2 = g[1]
      x3 = g[2]
      print len(t1)
      for i in range(len(t1)):
          # various set of t1,t2 and t3 gives the various eqns
          print i
          sol[i]=x1+t1[i]/(x2*t2[i]+x3*t3[i])-y[i]    
      return sol
  
  Anz = optimize.fsolve(fnz,g)
  
  print Anz
  </code></pre>
  
  <p>Could anyone please suggest where I'm wrong? Thank you in advance.</p>