This preview shows page 1. Sign up to view the full content.
Unformatted text preview: arametric plots in three dimensions by using the following syntax. plot3d( [ x-expr, y-expr, z-expr ], parameter1 =range, parameter2 =range ) Here are two examples.
> plot3d( [ sin(s), cos(s)*sin(t), sin(t) ], > s=-Pi..Pi, t=-Pi..Pi ); > plot3d( [ s*sin(s)*cos(t), s*cos(s)*cos(t), s*sin(t) ], > s=0..2*Pi, t=0..Pi ); Spherical Coordinates
The Cartesian (ordinary) coordinate system is only one of many coordinate systems in three dimensions. In the spherical coordinate system, the three coordinates are the distance r to the origin, the angle θ in the xy -plane measured in the counterclockwise direction from the x-axis, and the angle φ measured from the z -axis. 122 • Chapter 5: Plotting Figure 4.2 The Spherical Coordinate System z φ
0 x r y θ You can plot a function in spherical coordinates by using the sphereplot command in the plots package. To access the command with its short name, use with(plots). To avoid listing all the commands in the plots package, use a colon, rather than a semicolon.
> with(plots): Use the sphereplot command in the following manner. sphereplot( r-expr, theta =range, phi =range ) The graph of r = (4/3)θ sin φ looks like this:
> sphereplot( (4/3)^theta * sin(phi), > theta=-1..2*Pi, phi=0..Pi ); 5.2 Graphing in Three Dimensions • 123 To plot a sphere in spherical coordinates, specify the radius, perhaps 1, let θ run around the equator, and let φ run from the North Pole (φ = 0) to the South Pole (φ = π ).
> sphereplot( 1, theta=0..2*Pi, phi=0..Pi, > scaling=constrained ); For more information on constrained versus unconstrained plotting, see 5.1 Graphing in Two Dimensions. The sphereplot command also accepts parametrized plots, that is, functions that deﬁne the radius and both angle-coordinates in terms of two parameters, for example, s and t. The syntax is similar to a parametrized plot in Cartesian (ordinary) coordinates. See this section, page 121. sphereplot( [ r-expr, theta-expr, phi-expr ], parameter1 =range, parameter2 =range ) Here r = exp(s) + t, θ = cos(s + t), and φ = t2 .
> sphereplot( [ exp(s)+t, cos(s+t), t^2 ], > s=0..2*Pi, t=-2..2 ); 124 • Chapter 5: Plotting Cylindrical Coordinates
Specify a point in the cylindrical coordinate system using the three coordinates r, θ, and z . Here r and θ are polar coordinates (see section 5.1) in the xy -plane and z is the usual Cartesian z -coordinate.
Figure 4.3 The Cylindrical Coordinate System z 0 x y θ r You can plot a function in cylindrical coordinates by using the cylinderplot command in the plots package.
> with(plots): You can plot graphs in cylindrical coordinates by using the following syntax. cylinderplot( r-expr, angle =range, z =range ) Here is a three-dimensional version of the spiral previously shown in 5.1 Graphing in Two Dimensions.
> cylinderplot( theta, theta=0..4*Pi, z=-1..1 ); 5.2 Graphing in Three Dimensions • 125 To plot a cone in cylindrical coordinates, let r equal z and let θ vary from 0 to 2π .
> cylinderplot( z, the...
View Full Document