title: Overflow with numpy.exp()
body: <p>I have to find 3 parameters with the leastsq function of scipy, as the procedure is described <a href="http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html" rel="nofollow">here</a> in the part least-square fitting.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>def myFunc(t, Vs, Vi, k):
      y = Vs * t - ((Vs - Vi) * (1 - np.exp(-k * t)) / k)
      return y
  
  x = np.array(temps, dtype='float64')
  y = np.array(fluo, dtype='float64')
  
  Vs, Vi, k = [2.8707e-11, 0.01241, 19765.39043]
  
  def residuals(p, y, x):
      Vs, Vi, k = p
      err = y - myFunc(x, Vs, Vi, k) 
      return err
  
  def peval(x, p):
      return myFunc(x, p[0], p[1], p[2])
  
  p0 = [2.8707e-11, 0.01241, 19765.39043]
  plsq = leastsq(residuals, p0, args=(y, x))
  
  print(plsq[0])
  print(np.array([Vs, Vi, k]))
  </code></pre>
  
  <p>But I get the warning:</p>
  
  <pre><code>RuntimeWarning: overflow encountered in exp
  </code></pre>
  
  <p>I assume the number produced in exp is too big to fit in a <code>float64</code>. But I really need to make it fit. Is there any option to overcome this issue?</p>