|
From: Benjamin R. <ben...@ou...> - 2013-01-22 14:29:48
|
On Mon, Jan 21, 2013 at 8:06 PM, Pau <vim...@go...> wrote: > Hi, > > I am somehow new to matplotlib and I am trying to plot this function of x > ,y ,z > > F(x,y,z)= > 38244.74787*Pi*(x^2+y^2+z^2)^.125+1615.975261*Pi*z^2/(x^2+y^2+z^2)^.875-1292.780210*Pi*z^2/((x^2+y^2+z^2)^.875*(1+y^2/x^2))+1292.78*Pi*(x^2+y^2+z^2)^.125/(1+y^2/x^2) > > in a similar way as > > http://matplotlib.org/mpl_examples/mplot3d/contour3d_demo3.hires.png > > The code is > http://matplotlib.org/mpl_examples/mplot3d/contour3d_demo3.py > > But I have no idea where to start... > > some help would be appreciated... > > thanks > > The reason you are having difficulty coming up with a way to plot this is because you have 3 input dimensions, and 1 output dimension that you wish to plot. If you were to plot this in 3D space, it would have to be done as F(x,y,z) as a colored "mist" in the domain of (x,y,z). While a "mist" can't be done in mplot3d, you could plot out scatter points to emulate this. One could also use contourf3d(..., zdir='z', offset=...) to create slices of the filled contours, similar to this example: http://matplotlib.org/examples/mplot3d/contourf3d_demo2.html Now, if the domain of (x,y,z) can be parameterized as a surface (i.e., a sphere or a cylinder), then you are looking to do an image of F(x,y,z) plotted on that surface, which is a little bit difficult, but also do-able using the plot_surface() function. Cheers! Ben Root |