Contour Diagrams - FacStaff Home Page for...

28
> > > > > > > > > > Contour Diagrams restart:with(plots): setoptions3d(axes=NORMAL,labels=["x","y","z"],orientation=[20,70]); We start with the graph of z = fx, y = x 2 C y 2 and we plot its graph. z:=sqrt(x^2+y^2); z := x 2 C y 2 plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=patchnogrid) ; The graph appears to be that of an inverted cone of height 9. To find a contour line or level set for the surface, we first look at the intersection of the surface with a horizontal plane, say the plane z = 6. p1:=plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style= patchnogrid): p2:=plot3d(6,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style= patchnogrid): p3:=plot3d([6*cos(t),6*sin(t),6],t=0..2*Pi,u=0..5): display(p1,p2,p3);

Transcript of Contour Diagrams - FacStaff Home Page for...

Page 1: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

> >

> >

> >

Contour Diagramsrestart:with(plots):setoptions3d(axes=NORMAL,labels=["x","y","z"],orientation=[20,70]);

We start with the graph of z = f x, y = x2 C y2 and we plot its graph.z:=sqrt(x^2+y^2);

z := x2 C y2

plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=patchnogrid);

The graph appears to be that of an inverted cone of height 9. To find a contour line or level set for the surface, we first look at the intersection of the surface with a horizontal plane, say the plane z = 6.p1:=plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=patchnogrid):p2:=plot3d(6,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=patchnogrid):p3:=plot3d([6*cos(t),6*sin(t),6],t=0..2*Pi,u=0..5):display(p1,p2,p3);

Page 2: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > Then we project the curve(s) of intersection onto the xy-plane to get the contour line(s) or level set.p1:=plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=wireframe):p2:=plot3d(6,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=wireframe):p3:=plot3d([6*cos(t),6*sin(t),6],t=0..2*Pi,u=0..5):p4:=plot3d([6*cos(t),6*sin(t),0],t=0..2*Pi,u=0..5):p5:=plot3d([-6,0,t],t=0..6,u=0..5):p6:=plot3d([6,0,t],t=0..6,u=0..5):p7:=plot3d([0,-6,t],t=0..6,u=0..5):p8:=plot3d([0,6,t],t=0..6,u=0..5):display(p1,p2,p3,p4,p5,p6,p7,p8);

Page 3: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Using the plottools package and the transform command, we can get another view at how the contour diagram is developed by the intersections of planes with the surface being projected onto the xy-plane.with(plottools);annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse,ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola,icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project,rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform,translatep := plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],style=contour,contours=8):q := contourplot(z,x=-9..9,y=-9..9):f := transform((x,y) -> [x,y,0]):display({p,f(q)});

Page 4: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > A modification of the above shows the contours on the surface itself.p := contourplot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..9],filled=true):q := contourplot(z,x=-9..9,y=-9..9,filled=true):f := transform((x,y) -> [x,y,0]):display({p,f(q)});

Page 5: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

Now let's focus on just the contourplot for this surface. The option"scaling=constrained" is used to get the same scale on both the x- and the y-axis.contourplot(z,x=-9..9,y=-9..9,scaling=constrained);

Page 6: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

Curve 1 Curve 2 Curve 3 Curve 4Curve 5 Curve 6 Curve 7 Curve 8

xK8 K6 K4 K2 0 2 4 6 8

y

K8

K6

K4

K2

2

4

6

8

Maple chooses 8 equally spaced levels by default, with the contours colored in shades from red to blue asthey increase in size. You can also choose to fill in the contourscontourplot(z,x=-9..9,y=-9..9,scaling=constrained,filled=true);

Page 7: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > You can choose how many contours you wish.contourplot(z,x=-9..9,y=-9..9,contours=20,scaling=constrained);

Page 8: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19 Curve 20

xK8 K6 K4 2 4 6 8

y

K8

K6

K4

K2

2

4

6

8

You can also choose the levels for your contours.contourplot(z,x=-9..9,y=-9..9,contours=[1,2,3,4,5,6,7,8,9],scaling=constrained);

Page 9: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Curve 1 Curve 2 Curve 3 Curve 4Curve 5 Curve 6 Curve 7 Curve 8Curve 9

xK8 K6 K4 K2 0 2 4 6 8

y

K8

K6

K4

K2

2

4

6

8

The equal spacing of the contours for this function is due to the fact that the "sides" of the cone increase ata constant rate. Let's compare our original function to z=g x, y = x2 C y2.z:=x^2+y^2;

z := x2 C y2

plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..60],style=patchnogrid);

Page 10: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

We see that the sides here do not increase at a constant rate. We consider 20 equally spaced contours, the multiples of 3 from 3 to 60.contourplot(z,x=-9..9,y=-9..9,contours=[seq(3*i,i=1..20)],scaling=constrained);

Page 11: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19 Curve 20

xK6 K4 K2 0 2 4 6

y

K6

K4

K2

2

4

6

We see that the contours become closer as the height of the level increases, indicating a greater rate of change in the positive direction as the height of the level increases. Now let's flip this surface upside down.z:=60-(x^2+y^2);

z := Kx2 K y2 C 60plot3d(z,x=-9..9,y=-9..9,view=[-9..9,-9..9,0..60],style=patchnogrid);

Page 12: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We compare the contour plot here with the previous one.contourplot(z,x=-9..9,y=-9..9,contours=[seq(3*i,i=1..20)],scaling=constrained,filled=true);

Page 13: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

We see that the contours become closer as the height of the level decreases, indicating a greater rate of change in the negative direction as the height of the level decreases. We next look at a more interesting surface, the saddle, with this one given by the function z = f x, y = x2 K y2.z:=x^2-y^2;

z := x2 K y2

plot3d(z,x=-4..4,y=-4..4,style=patchnogrid);

Page 14: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We look first at the level z = 0.p1:=plot3d(z,x=-4..4,y=-4..4,style=patchnogrid):p2:=plot3d(0,x=-4..4,y=-4..4,style=patchnogrid,color=blue):p3:=plot3d([x,x,0],x=-4..4,y=-4..4,thickness=5):p4:=plot3d([-x,x,0],x=-4..4,y=-4..4,thickness=5):display(p1,p2,p3,p4);

Page 15: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

A close inspection suggests the plane intersects the saddle in two intersecting lines. Changing the view gives a better perspective on this.p1:=plot3d(z,x=-4..4,y=-4..4,style=patchnogrid):p2:=plot3d(0,x=-4..4,y=-4..4,style=patchnogrid,color=blue):p3:=plot3d([x,x,0],x=-4..4,y=-4..4,thickness=5):p4:=plot3d([-x,x,0],x=-4..4,y=-4..4,thickness=5):display(p1,p2,p3,p4,orientation=[27,32]);

Page 16: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

In fact, the lines we see are the lines xC y = 0 and xK y = 0. What will we get from the intersections of other horizontal planes? We look at the contour diagram for 19 equally spaced contours.contourplot(z,x=-9..9,y=-9..9,contours=[seq(3*i,i=-9..9)],scaling=constrained);

Page 17: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19

xK8 K6 K4 2 4 6 8

y

K8

K6

K4

K2

2

4

6

8

We first notice the two intersecting lines at the origin resulting from the plane z = 0 viewed above. The nine horizontal planes for negative levels intersect the saddle in hyperbolas, with the two branches shown above and below the x-axis in shades of red. The nine horizontal planes for positive levels also intersect the saddle in hyperbolas, but with the two branches shown left and right of the y-axis in shades of blue. We view another contourplot for the same function.contourplot(z,x=-9..9,y=-9..9,contours=20,scaling=constrained);

Page 18: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19 Curve 20

xK8 K6 K4 2 4 6 8

y

K8

K6

K4

K2

2

4

6

8

Next we look at the contour diagram for a plane.z:=-4*x-3*y+24;

z := K4 xK 3 yC 24plot3d(z,x=-8..8,y=-10..10,view=[0..8,-0..10,0..26],style=patchnogrid);

Page 19: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > The contour diagram.contourplot(z,x=-10..10,y=-10..10,contours=20,scaling=constrained);

Page 20: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19 Curve 20

xK10 K5 0 5 10

y

K10

K5

5

10

Notice that the contours are parallel lines. Our final surface has many interesting aspects.z:=cos(x)*cos(y)*exp(-sqrt(x^2+y^2)/4);

z := cos x cos y eK

14

x2 C y2

plot3d(z,x=-10..10,y=-10..10,style=patchnogrid,numpoints=5000);

Page 21: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We view a contour diagram with 20 equally spaced contours.contourplot(z,x=-10..10,y=-10..10,contours=20,scaling=constrained,numpoints=5000);

Page 22: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

Curve 1 Curve 2 Curve 3Curve 4 Curve 5 Curve 6Curve 7 Curve 8 Curve 9Curve 10 Curve 11 Curve 12Curve 13 Curve 14 Curve 15Curve 16 Curve 17 Curve 18Curve 19 Curve 20

xK10 K5 0 5 10

y

K10

K5

5

10

This contour diagram shows that the most radical behavior for this function lies near the origin of the xy-plane (deep reds and blues) with the surface staying pretty close to the xy-plane away from the origin (violets away from the origin). Last, we look at the 3d and 2d contour diagrams together.p := contourplot3d(z,x=-9..9,y=-9..9,filled=true):q := contourplot(z,x=-9..9,y=-9..9,filled=true):f := transform((x,y) -> [x,y,-1]):display({p,f(q)});

Page 23: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> >

> >

Density PlotsWe use the densityplot command to form density plots. We will use the saddle function as an example.z:=x^2-y^2;

z := x2 K y2

densityplot(z,x=-9..9,y=-9..9);

Page 24: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We can remove the gridlines.densityplot(z,x=-9..9,y=-9..9,style=patchnogrid);

Page 25: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We can choose a color.densityplot(z,x=-9..9,y=-9..9,style=patchnogrid,color=green);

Page 26: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > We can use a variety of colors.densityplot(z,x=-9..9,y=-9..9,style=patchnogrid,colorstyle=HUE);

Page 27: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of

> > Finally, we can change the brightness and contrast.densityplot(z,x=-9..9,y=-9..9,style=patchnogrid,colorstyle=HUE,brightness=0.7,contrast=0.7);

Page 28: Contour Diagrams - FacStaff Home Page for CBUfacstaff.cbu.edu/wschrein/media/Calc3WS/contour(12.1).pdf · Contour Diagrams restart:with(plots): ... Then we project the curve(s) of