Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In different disciplines, phi and theta mean different things. In Sage, we use "azimuth", "elevation", and "inclination", rather than "phi" and "theta". See mathworld for many ways in which spherical coordinates are phrased in different disciplines.

In Sage, you can define the coordinates however you choose. The spherical_plot3d function adopts the convention that the first argument is the azimuth angle and the second angle is the inclination angle (or "polar angle"). This is consistent with calculus textbooks, for example, and provides a natural extension of the polar plot commands (where the single parameter is the azimuth angle).

Note that in mathematica, the SphericalPlot3d "phi" corresponds to the PolarPlot "theta" (that's the azimuth angle) and the SphericalPlot3d "theta" is the inclination angle (which in lots of calculus textbooks is called "phi"). So according to many calculus textbook, and according to the Wolfram Mathworld website, Mathematica has the names backwards (i.e., Mathematica uses theta for inclination angle and phi for azimuth angle, whereas typical mathematical convention is to use theta for azimuth angle and phi for inclination angle).

Read the documentation to Spherical to see how to change the coordinate system to match Mathematica's order. For example, try this:

T = Spherical('radius', ['inclination', 'azimuth']) # matches Mathematica ordering
plot3d(1+2*cos(2*theta), (theta, 0, pi), (phi, 0, 2*pi), transformation=T, aspect_ratio=1)

Note that Sage has many other transformations built in, and lets you define your own transformations however you want. See the examples in the plot3d documentation