I am trying to plot the wave function for a particle in a 3D box. This requires me to plot 4 variables: x, y, z axes and the probability density function.
The probability density function is:
abs((np.sin((p*np.pi*X)/a))*(np.sin((q*np.pi*Y)/b))*(np.sin((r*np.pi*Z)/c)))**2
I am using np.arange()
for the X, Y and Z.
I have read that to do this you need to plot the surface of a 4D plot. Here is what it is supposed to look like:
You want to plot a 3D scalar field f(x,y,z) against all three spatial coordinates. I am not sure what you're precisely willing to do: which surfaces are you talking about ? You may want to plot iso-density surfaces, which allow for clear visualization of the field. I don't know the Matplotlib formulation for this, but with Mayavi2 (a great 3D-plotting Python library) you can use "contour3d" : http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html#mayavi.mlab.contour3d
Anyway if you're willing to do advanced 3D stuff Mayavi is way better than Matplotlib. See the gallery for examples : http://docs.enthought.com/mayavi/mayavi/auto/examples.html
Hope that helps !