title: ValueError: math domain error
body: <p>I was just testing an example from <em>Numerical Methods in Engineering with Python</em>.</p>
  
  <pre><code>from numpy import zeros, array
  from math import sin, log
  from newtonRaphson2 import *
  
  def f(x):
      f = zeros(len(x))
      f[0] = sin(x[0]) + x[1]**2 + log(x[2]) - 7.0
      f[1] = 3.0*x[0] + 2.0**x[1] - x[2]**3 + 1.0
      f[2] = x[0] + x[1] + x[2] -5.0
      return f
  
  x = array([1.0, 1.0, 1.0])
  print newtonRaphson2(f,x)
  </code></pre>
  
  <p>When I run it, it shows the following error:</p>
  
  <pre><code>File "example NR2method.py", line 8, in f
      f[0] = sin(x[0]) + x[1]**2 + log(x[2]) - 7.0
  ValueError: math domain error
  </code></pre>
  
  <p>I have narrowed it down to the log as when I remove log and add a different function, it works. I assume it is because of some sort of interference with the base, I can't figure out how. Can anyone suggest a solution?</p>