>

Plotting with 2 and 3-dimensional functions



We need to use with(plots)

> with(plots):

>

The first function we look at is sin(x)cos(y).
We plot the curve and look at its contours.
We then repeat this process with several other functions.

> f:=sin(x)*cos(y);

[Maple Math]

> plot3d(f,x=0..2*Pi,y=0..2*Pi);

> contourplot(f,x=0..2*Pi,y=0..2*Pi);

>

Second function:

> g:=(x^2+3*y^2)*exp(-x^2-y^2);

[Maple Math]

> plot3d(g,x=-3..3,y=-3..3);

> contourplot(g,x=-3..3,y=-3..3);

>

Third function:

> h:=x*y;

[Maple Math]

> plot3d(h,x=-2..2,y=-2..2);

> contourplot(h,x=-2..2,y=-2..2);

>

Fourth function:

> l:=x/(x^2+y^2+1);

[Maple Math]

> plot3d(l,x=-4..4,y=-4..4);

> contourplot(l,x=-4..4,y=-4..4);

>

We now look at a function of three variables,
and we plot two of its contours.
The contours are ellipsoids.

> q:=x^2+4*y^2+z^2;

[Maple Math]

>

The function implicitplot3d will plot the points that
give the function q a specified value;
ie, implicitplot can be used to plot a contour of q.

> implicitplot3d(q=1,x=-1..1,y=-1..1,z=-1..1,color=red);

> implicitplot3d(q=4,x=-2..2,y=-2..2,z=-2..2,color=yellow);

>

We are going to plot the two contours on the same graph.
The second contour totally surrounds the first one,
so we plot just half of the second contour.

> one:=implicitplot3d(q=1,x=-1..1,y=-1..1,z=-1..1,color=red):

> two:=implicitplot3d(q=4,x=-2..2,y=0..2,z=-2..2,color=yellow):

> display3d({one,two});

>