plot 3d introduction - alfred universitypeople.alfred.edu/~ffrey/plot_3d/plot3d_manual.pdf · plot...

16
Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes: 1. Cartesian mode, where surfaces defined by equations of the form are graphed in Cartesian coordinates, 2. cylindrical mode, where surfaces defined by equations of the form are graphed in cylindrical coordinates, 3. spherical mode, where surfaces defined by equations of the form are graphed in spherical coordinates, 4. parametric (1 variable mode), where curves defined parametrically by equations of the form are graphed in Cartesian coordinates, and 5. parametric (2 variables mode), where surfaces defined parametrically by equations of the form are graphed in Cartesian coordinates. When Plot 3D is opened, it is in the default Cartesian mode. First Example Let’s begin by graphing the surface defined by the Cartesian equation over the square domain . After you have opened Plot 3D and clicked through the title pages, a screen containing a window with a green border should appear. This window is called the status window. The status window gives information about the graph to be drawn. In the status window there is an edit box just to the right of “z =”. Type “x^2 + y^2” in that box. Just below that box are two edit boxes that define the screen x-interval. Change the “-10” to “-2” and the “10” to “2”, so that the screen x-interval is defined to be . Similarly define the screen y-interval to be . Note that within this domain the z values range from 0 to 8, so redefine the screen z-interval to be . Next select “Graph Active Functions” from the Action menu. After the graph is drawn, your screen should look something like Figure 1. It may be difficult to perceive that this graph is a surface of revolution, more precisely, it is a parabola in the xz-plane, represented by the equation , revolved about the z-axis. One way to get a better representation is to cut the graph off at the plane by redefining the screen interval to be The Status Window - Cartesian Mode At the top of the window is the heading “Cartesian Function #:” followed by a list button containing the numbers 1 through 10. For each of its five modes Plot 3D can access up to 10 functions at a time. The number showing in the list box represents the identification number for the “current” function, whose formula is displayed in the status window. Next is the edit window containing the formula for the current function. The check mark in the box in front of

Upload: others

Post on 06-Jul-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Plot 3D

Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

1. Cartesian mode, where surfaces defined by equations of the form are graphed

in Cartesian coordinates,

2. cylindrical mode, where surfaces defined by equations of the form are

graphed in cylindrical coordinates,

3. spherical mode, where surfaces defined by equations of the form are

graphed in spherical coordinates,

4. parametric (1 variable mode), where curves defined parametrically by equations of the

form are graphed in Cartesian coordinates, and

5. parametric (2 variables mode), where surfaces defined parametrically by equations of the

form are graphed in Cartesian coordinates.

When Plot 3D is opened, it is in the default Cartesian mode.

First Example Let’s begin by graphing the surface defined by the Cartesian equation over the

square domain . After you have opened Plot 3D and clicked through the title

pages, a screen containing a window with a green border should appear. This window is called

the status window. The status window gives information about the graph to be drawn. In the

status window there is an edit box just to the right of “z =”. Type “x^2 + y^2” in that box. Just

below that box are two edit boxes that define the screen x-interval. Change the “-10” to “-2” and

the “10” to “2”, so that the screen x-interval is defined to be . Similarly define the screen

y-interval to be . Note that within this domain the z values range from 0 to 8, so redefine

the screen z-interval to be . Next select “Graph Active Functions” from the Action menu.

After the graph is drawn, your screen should look something like Figure 1.

It may be difficult to perceive that this graph is a surface of revolution, more precisely, it is a

parabola in the xz-plane, represented by the equation , revolved about the z-axis. One

way to get a better representation is to cut the graph off at the plane by redefining the

screen interval to be

The Status Window - Cartesian Mode

At the top of the window is the heading “Cartesian Function #:” followed by a list button

containing the numbers 1 through 10. For each of its five modes Plot 3D can access up to 10

functions at a time. The number showing in the list box represents the identification number for

the “current” function, whose formula is displayed in the status window. Next is the edit

window containing the formula for the current function. The check mark in the box in front of

Page 2: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

“z =” means that the current function is “active”, that is, it will be plotted upon the next

execution of the “Graph Active Functions” menu item. To change an active function to inactive

(so that it will not be plotted), click the mouse on the check box, and the check mark will

disappear. Another click on the check box will revert the function back to an active one.

Figure 1

The screen x-, y- and z- intervals define a viewing cube whose projection will just fit inside the

graph window. There are edit boxes for each end point of each interval. The screen x- and y-

intervals are common to all functions. Next are two sets of radio buttons used to determine

whether or not 1) the coordinate axes are to be drawn, and 2) whether or not a box enclosing the

viewing cube is to be drawn. Note that when the viewing cube box is to be drawn, the graphs are

clipped so that only the portion of the graph inside the viewing rectangle is plotted. When the

viewing cube box is not plotted, such clipping does not occur; that is, any portion of the graph

that may appear inside the graph window but outside the viewing cube will also be drawn. To

see the difference, try graphing the last example ( with viewing cube

) by first graphing the viewing cube box, then by not graphing it.

Upon launching, Plot 3D is set not to plot the coordinate axes, and to plot the viewing cube box

in all modes. The x-Axis/Box unit number indicates how far apart the scale marks are on the x-

axis, and how far apart scale marks are on the viewing cube box edges that are parallel to the x-

axis. Similarly for the y- and z-Axis/Box units. Note that the default value for the Axis/Box

units is zero, which means that scale marks will not appear at all.

There are three sets of individual function options. First, the plot x- and y- intervals refer to the x

and y values that will actually be used to graph the current function. Whereas the screen x- and y-

Page 3: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

intervals, which are used to define the base of the viewing cube, are common to all functions,

each function may have its own x- and y-plot intervals. Note that the x- and y- plot intervals

cannot be defined unless there is already a defined formula for the current function. When a

formula is first defined for a function, the default definitions for the plot intervals are those of the

corresponding screen intervals. If the corresponding endpoints for corresponding screen and plot

intervals are the same, and the screen end point is changed, the plot end point will automatically

be changed accordingly.

Second, when Plot 3D is in its default hidden surface mode, the “top” of the surface and the

“bottom” of the surface are shaded according to user defined options. The default color setting is

blue for the top of the surface, and cyan for the bottom of the surface.

Third, there are the x- and y-direction resolution factors, both of whose defaults settings are 15.

With these factors the plot x- and y- intervals are divided into fifteen equal subintervals, which

then create a 15 x 15 grid of rectangles. Over each rectangle the boundaries of the surface

defined by the function are plotted. The x- and y-direction options allow the user to choose a

different number of subintervals into which the screen x- and y-intervals may be subdivided. The

more subintervals, the higher the resolution will be, but a higher resolution will cause the graph

to be plotted more slowly. When Plot 3D is in the hidden surface mode (the default), the upper

limit to the number of rectangles that may be in the domain grid depends on the number of active

functions there are when the “Graph Active Functions” option is selected.

The Menu Options We start with the Action menu. The “Erase Graph Window” option clears the graph window of

its contents. It also clears the title defined through the “Title” option in the Special menu. The

“Clear All Formulas” option puts the current mode (Cartesian, cylindrical, spherical, etc.) back

to its default status at the beginning of the execution of the program. “Expand Current Formula”

can be used when one formula is defined in terms of another. For example, suppose you want to

graph the surface . You may want to break the formula down into parts. Define

the formula for function number 1 to be and the formula for function number 2 to be .

Switch to function number 3 and type “#1-#2” in the “z =” text box. This notation involving the

“#” symbol means that the formula for function number 3 is the formula for function number 1

minus the formula for function number 2. If, while the current function is number 3, you select

the “Expand Current Formula” option, the contents of the “z =” text box changes to “x^2*y –

2*y^3”. Note that the expanded formula does not employ implicit multiplication.

When you choose the “Rotate” option, you will be asked about which of the Cartesian coordinate

axes you wish to rotate, then how many degrees. Subsequent graphs will rotate the surface and

the coordinate system counterclockwise (as viewed from the designated positive coordinate axis

looking toward the origin) the designated number of degrees about the designated coordinate

axis. Subsequent selections of the “Rotate” option build on previous rotations, unless you choose

the “Clear Rotations” option, at which time all previous rotations are cancelled.

Page 4: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

The “Graph Level Curves” option works only when Plot 3D is in the wire mesh mode. When

this option is selected the level curves are drawn. The constant

is the left endpoint of the screen z-interval, is the right endpoint, and the other ’s are equally

spaced in between. Figure 2 shows the result of choosing this option for the equation

over the viewing cube . Note that in this picture only

six of the seven level curves appear. The first one is , which is just a single point.

Figure 2

The “Graph Contours” option projects the level curves of the previous option onto the xy-plane

(z = 0). Figure 3 shows the result of Figure 2 followed by the execution of the “Graph Contours”

option. If you start with an empty graph window, rotate the z-axis 20 degrees and the y-axis 110

degrees, and then select the “Graph Contours” option, you get a standard contour plot. Figure 4

shows the result of such operations for the formula over the viewing cube

.

The "Graph Active Functions" option plots all of the functions that are currently tagged as

active. If Plot 3D senses that a graph is already plotted, it will first ask if the current plot should

be erased. The default answer to that question is "yes" and is the appropriate answer the vast

majority of times. Be very careful when answering the question "No".

When you choose the “Exit Plot 3D” option, you will be asked if you want to save the current

settings. If you answer yes, Plot 3D asks you for the name of a file to store those settings in. The

next time you launch Plot 3D, you can restore these settings by choosing the “Open” option in

Page 5: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

the File menu. You do not have to wait until you are ready to exit Plot 3D to save settings. Just

choose the “Save” option from the File menu any time you want to save the current settings.

There are two “Save options: 1) “Parameters” and 2) “Image”. If you choose the “Parameters”

option, you will be asked to give the name of a file in which to store the current settings

(formulas, screen domains, etc.). It is this type of file that can then be opened with the “Open”

option. The “Image” option allows you to store in a user named file all or part of the contents of

the graph window. This file can then be inserted into a text editor, such as Microsoft Word.

Figure 3

When the “Zoom In” option is selected from the Resize menu, the active functions are redrawn,

along with the coordinate axes and/or viewing cube box (if desired). The screen x-, y-, and z-

intervals are half as long as the previous intervals and the center of the graph window is the same

as previous one. The “Zoom Out” option is like “Zoom In”, except the screen x-, y-, and z-

intervals are doubled, rather than halved, in length. The “Undo” option reverts the end points of

each of the three screen intervals to their previous definitions.

There are two options in the Special menu. When the “Label” option is chosen, a cursor, which

may be relocated by moving the mouse, appears on the graph window. Click the mouse to

designate the lower left corner of the label, type the desired label text, and then hit the “Enter”

(or “return”) key. Also, if you are especially proud of your graph, you can give it a title by using

the “Title” option. You can give it any title you wish, but if you want to use a currently defined

formula as the title, then type “#nn”, when nn is the formula number. The title will take the form

“z = *******”, where “*******” represents the formula for function number nn. The title will

appear just below the graph window.

Page 6: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Figure 4

The first option in the Change menu is “Orientation”. It is assumed in Plot 3D that the viewer is

looking directly at the origin and the image projection plane is perpendicular to the line of sight

from the view to the origin. To create the proper perspective, four pieces of information are

needed:

1. θ, the angle that the projection of the line of sight onto the xy-plane makes with the x-

axis,

2. φ, the angle that the line of sight makes with the z-axis,

3. ρ, the distance from the viewer to the origin, and

4. D, the distance from the viewer to the projection plane.

Note that in order to get a good perspective, the surface being drawn should be approximately

centered about the origin. Note also that represents the spherical coordinates of the

viewer. The default value for θ is 20 degrees and the default value for φ is 70 degrees. Once the

two angles are specified, Plot 3D will automatically determine values for the two distances based

upon the user specified viewing cube (screen x-, y-, and z-intervals).

The last menu is Mode. As was mentioned earlier, there are five basic modes – Cartesian,

cylindrical, spherical, parametric (1 variable) and parametric (2 variables), but there are also

modes that will affect how the graph will be plotted. Note that some of the mode items are

checked, which indicates that those modes are the ones currently in effect. Note also that there

are two groups of modes, with the groups separated by a horizontal line. Within each group one

and only one mode will be in effect at any given time.

Let’s start with group at the bottom. When Plot 3D is in wire mesh mode, boundaries of the

surfaces drawn over grid cells are not ever obscured, even when they are lie behind other grid

Page 7: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

cell surfaces. The surface itself is considered to be transparent. Figure 5 shows the result of

graphing in the viewing cube and in wire mesh mode.

Figure 5

In the wire mesh mode, you may specify either the screen x-interval or the screen y-interval (but

not both) resolution to be zero. For example, suppose that the screen x-interval is and the

screen y-interval is . If you specify that the screen y-interval resolution to be zero and the

screen x-interval to be n, then upon the next selection of the “Graph Active Functions” option,

Plot 3D will graph the constant coordinate curves , and

where – . Figure 6 shows the graph of in the viewing cube

and with the screen y-interval resolution set to zero.

In hidden surface mode the surface boundaries are drawn, starting with the surface element

farthest from the viewer. After the boundaries for a particular surface element are drawn, the

interior is colored according to whether the top or bottom of the surface is showing. This

coloring hides any portion of the surface behind the current surface element.

Cylindrical Mode Plot 3D’s second basic mode, cylindrical, graphs functions of the form ], where

represents the cylindrical coordinates of a point. Most computer keyboards do not have

a θ key, so we use the variable t instead. The status window looks much the same as it does in

Cartesian mode with the following exceptions. The first line refers to “Cylindrical Function #”

Page 8: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Figure 6

rather than “Cartesian Function #”. When a formula is defined, it is defined in terms of the

variables r and t rather than the variables x and y. Also, even though the screen intervals are set

up as before in Cartesian coordinates in order to create a viewing cube, there are plot r- and t-

intervals rather than plot x- and y-intervals. The r- and t-direction resolutions are used to

subdivide the plot intervals which in turn are used to form a grid based upon circular sectors

rather than the rectangles of Cartesian coordinates. A typical grid cell looks like the one

illustrated in Figure 7. The circular domain determined by defining the plot r-interval to be

and the plot t-interval to be and with the r- and t-direction resolutions both set to 10

is shown in Figure 8.

Figure 7 Figure 8

Page 9: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Now recall our first example, where we graphed the surface (in Cartesian coordinates) defined

by the equation . Since the graph of this equation is a surface formed by revolving

a curve about the z-axis, it might be better to use cylindrical coordinates. In cylindrical

coordinates the surface equation becomes , and if you sketch this surface in hidden

surface mode by defining the plot r-interval as and the plot t-interval as (the default

plot t-interval), your graph should look like Figure 9.

Figure 9

As another example consider the equation . The presence of the term

suggests conversion to cylindrical coordinates, so that the equation becomes . Note

that there is a singularity when r equals one. With Plot 3D in cylindrical mode, enter into the “z

=” edit box “1/(1-r^2)”. Set the screen intervals so that the viewing cube is

. Define the plot r-interval as and the plot t-

interval as . Next, switch to function number 2 and in its “z =” edit box type “#1”. Set the

plot r-interval for function number 2 to be . If you choose not to plot the coordinate

axes nor the viewing cube box, then upon selecting the “Graph Active Functions” option your

graph should look like that of Figure 10. (The top and bottom surface colors were changed, just

for variety.)

A final example for the cylindrical mode comes from the study of limits for functions of two

variables. Let . This function is often studied to demonstrate a function

whose limit as approaches along any straight line exists, but the general limit as

approaches does not exist. A graph of this function in Cartesian coordinates is not

Page 10: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

very descriptive, but converting to cylindrical coordinates so that gives the

graph depicted in Figure 11. Note that the r-direction resolution is 6 and the t-direction

resolution is 50 (the maximum allowed).

Figure 10

Spherical Mode The third basic mode is spherical, where surfaces defined by equations of the form

are graphed. Here represents the spherical coordinates of a three dimensional point.

The spherical coordinates are related to three dimensional Cartesian coordinates be means of the

equations and . The values of the spherical

coordinates have the restrictions , , and so that each point not

on the z-axis has a unique set of coordinates. Because most computer keyboards do not have

Greek letter keys, we use the variable t instead of θ, the variable s instead of φ, and the variable r

instead of ρ. The status window looks much the same as it does in Cartesian mode with a few

exceptions. The first line refers to “Spherical Function #” rather than “Cartesian Function #”.

The edit box in which the function’s formula is defined is headed by “r =” rather than “z =” and

the formulas themselves are expressed in terms of the variables t and s rather than x and y. Also,

there are plot t- and s-intervals rather than plot x- and y-intervals. The t- and s-direction

Page 11: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

resolutions are used to subdivide the plot intervals which are in turn used to form a graphing

grid.

Figure 11

A simple example of a graph in spherical coordinates is the constant function . If you

graph this function in hidden surface mode the result should look like Figure 12. Note that the t

(or θ) constant curves correspond to longitudes on a globe while the s (or φ) constant curves

correspond to latitudes on a globe.

Parametric (1 Variable) Mode The first of the parametric modes involves only one parameter, t, so that the parametric equations

describe curves, not surfaces, in space. The x-, y-, and z- coordinates are defined parametrically

by equations of the form . A look at the status window reveals a few differences from

the Cartesian mode status window. The heading for the current function list box is “Parametric1

Function #:” rather than “Cartesian Function #:”. Also the x-, y- and z- equations are defined

separately. There is only one plot interval, corresponding to the parameter t, and it defaults to

the interval . Rather than color options for the top and bottom of the surface, there is a

single color option for graphing the curve. The resolution factor defaults to 25, which means that

the plot t-interval is divided into 200 subintervals for graphing purposes. The parametric graph

is approximated by a straight line over each subinterval. Each unit increase in the resolution

factor causes the plot t-interval to be divided into 4 more subintervals. Thus, for example, a

resolution factor of 0 will divide the plot t-interval into 100 subintervals, whereas a resolution

Page 12: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

factor of 75 will divide the plot t-interval into 400 subintervals. Some other differences between

the parametric (1 variable) mode and Cartesian mode are:

Figure 12

When giving a title to a graph, it is not possible to use the convention “#nn”, where “nn”

represents a function identification number.

Though it is possible to select either the “Wire Mesh” or Hidden Surface” in the Mode

menu, such a selection will not change the appearance of the graph.

As an example of a graph in the parametric (1 variable mode), consider the parametric equations

, which describes a spiral. Define the screen x-interval as , the screen y-

interval as , the screen z-interval as , and the plot t-interval as . If you choose to

graph the coordinate axes but not the viewing cube box, your graph should look like Figure 13.

Parametric (2 Variables) Mode The parametric (2 variables) mode can be an extremely useful mode to work in, as the following

examples show. For example, it is sometimes not practical to consider rectangular regions in the

xy-plane as domains, as is required in the Cartesian mode. As an illustration, con

sider the equation , whose graph is an ellipsoid. If we solve for z, we get

. Hence, the surface is described by two functions, each of which has an

Page 13: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

ellipse as its domain. The following parameterization, reminiscent of cylindrical coordinates,

allows us to sketch the graph of the function representing the top surface over the elliptical

domain. Let . Then as s goes from 0 to 1 and t goes from 0 to , the x and y

variables span the ellipse and its interior. If you define the screen x-interval

as , the screen y-interval as , the screen z-interval as and you opt to plot the

coordinate axes but not the viewing cube box, your graph should look like Figure 14.

Figure 13

Next, consider the parameterization with s going from 0 to 1 and t going from 0

to . With the screen x-interval defined as , the screen y-interval defined as , and

the screen z-interval as , the resulting graph will be a cylinder as in Figure 15. Note the s-

and t-direction resolutions were changed from 15 to 10 handle a minor shading problem at the

top of the surface.

Now let’s tackle the problem of graphing the intersection of two cylinders. Be forewarned, this

is a rather complicated example. Suppose the two cylinders to be graphed are represented by the

equations and . The hidden surface algorithm of Plot 3D is not

sophisticated enough to handle correctly the drawing of surface grid elements from two different

functions that partially hide each other. Thus some care must be taken to ensure that grid surface

Page 14: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Figure 14

Figure 15

Page 15: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

elements from different functions intersect only along their edges. Note that the two cylinders

being considered intersect in the planes . We will consider first the case where all three

variables x, y, and z are positive. The first cylinder will be parameterized as

Note that . Further, as s goes from 0 to 1, then y

goes from , or z, to 4. When then , so y goes from 0 to 4, and when ,

then s, so in this case y goes from 1 to 4 when s goes from 0 to 1. Similarly,

parameterize the second cylinder as with s going from 0 to

1 and t going from 0 to . In Plot 3D let the s-direction resolution factor be 1 and the t direction

factor be 5 for both functions. Define the screen x-interval as , the screen y-interval as ,

and the screen z-interval as . The resulting graph should look like Figure 16.

Figure 16

Figure 17 extends the intersection depicted in Figure 16 to the other seven octants. Over the three

other octants where the x-coordinate is positive, the two cylinders are parameterized in a fashion

similar to the parameterizations for the first octant. Thus it took eight parameterizations to

complete the graph when x is greater than zero. Two other parameterizations were used when x

is less than zero.

Page 16: Plot 3D Introduction - Alfred Universitypeople.alfred.edu/~ffrey/Plot_3d/PLot3D_Manual.pdf · Plot 3D Introduction Plot 3D graphs objects in three dimensions. It has five basic modes:

Figure 17