title: How to use scipy least_squares to get the estimation of unknow variables
body: <p>I am a newbie in using scipy.optimize. I have the following function calls func. I have x and y values given as a list and need to get the estimated value of a, b and c. I could use curve_fit to get the estimation of a, b and c. However, I want to explore the possibilities of using least_squares.
  When I run the following code, I get the below error. It'd be great if anyone could point me to the right direction.</p>
  <pre><code>import numpy as np
  from scipy.optimize import curve_fit
  from scipy.optimize import least_squares
  
  np.random.seed(0)
  
  x = np.random.randint(0, 100, 100) # sample dataset for independent variables
  y = np.random.randint(0, 100, 100) # sample dataset for dependent variables  
  
  def func(x,a,b,c):
      return a*x**2 + b*x + c
  
  def result(list_x, list_y):
        popt = curve_fit(func, list_x, list_y)
      
  sol = least_squares(result,x, args=(y,),method='lm',jac='2-point',max_nfev=2000)   
  
  TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be 
  safely coerced to any supported types according to the casting rule ''safe''
  </code></pre>