title: Why is "name 'x' not defined" when trying to implement the Newton-Raphson method?
body: <p>I want to find the zeros of a simple function for given parameters a, b, c. I have to use the Newton-Raphson method. The problem I obtain when I compile the code is that the <code>x</code> variable is not defined.</p>
  <pre><code>from scipy import optimize
  
  def Zeros(a, b, c, u):
    return optimize.newton(a*x**2+b*x+c, u, 2*ax+b, args=(a, b, c))
  </code></pre>
  <p>a, b, c are constants of the function f and u is the starting point. So with this function I should be able to obtain a zero by specifying a, b, c and u. For instance:</p>
  <pre><code>print Zeros(1, -1, 0, 0.8)
  </code></pre>
  <p>But I obtain &quot;global name 'x' is not defined&quot;.</p>
  <p>Why does that happen?</p>