title: Plotting a function of three variables in python
body: <p>I would like to plot the contour lines for this function, however I cannot find any useful way to do it.</p>
  
  <p>The potential function is :
  <code>V(x,y,z) = cos(10x) + cos(10y) + cos(10z) + 2*(x^2 + y^2 + z^2)</code> </p>
  
  <p>I unsuccessfully attempted something like:</p>
  
  <pre><code>import numpy
  import matplotlib.pyplot.contour
  
  def V(x,y,z):
      return numpy.cos(10*x) + numpy.cos(10*y) + numpy.cos(10*z) + 2*(x**2 + y**2 + z**2)
  
  X, Y, Z = numpy.mgrid[-1:1:100j, -1:1:100j, -1:1:100j]
  </code></pre>
  
  <p>But then, I don't know how to do the next step to plot it?</p>
  
  <pre><code>matplotlib.pyplot.contour(X,Y,Z,V)
  </code></pre>