Math 210

Maple Lab 2 on Surfaces

from material developed by John Wood


> restart;
# Maple commands are indicated by a ">" in front of them.
# Using the menu, try style  patch and contour  and
# color z(Hue). You can turn the picture by  holding the
# mouse button down and dragging. Try the view from the
# top.  A nice surface.
> plot3d(x^3-x+3*y^2, x=-3..3,y=-3..3);
# This is one method of defining a function:
> f:=x->x^2-x+1;
# This is the derivative of f:
> D(f);
> D(f)(x);
# Here is another method of defining a function:
> h := unapply(x^2-x+1,x);
> h;
> D(h);
> h(q);
> D(h)(s);
# We now construct a function which gives the
# tangent line function at a point x=2:
> tf :=x->f(2) + D(f)(2)*(x-2);
# The tangent line at (2,f(2)):
> tf(x);
> plot({f(x),tf(x)},x=0..4);
# To plot the tangent line at any point:
> Tf := (x,x0)->f(x0)+D(f)(x0)*(x-x0);
> Tf(x,3);
> plot({f(x),Tf(x,3)},x=0..5);
> g:=(x,y)->x^3-x+3*y^2;
# This is the function we plotted above.
# The partial derivative with respect to x:
> D[1](g);
# The partial derivative with respect to y:
> D[2](g);
# Now on to the tangent plane function
#  at (1,2):
> tg:=(x,y)->g(1,2)+D[1](g)(1,2)*(x-1) + D[2](g)(1,2)*(y-2);
# The tangent plane:
> tg(x,y);
# Cut by the plane x=1:
> plot({g(1,y),tg(1,y)},y=-3..3);
# Cut by the plane y=2:
> plot({g(x,2),tg(x,2)},x=-3..3);
# View the following plot of g and its tangent plane from
# different angles, and with different colorings and
# styles.
> plot3d( {g(x,y),tg(x,y)},x=-3..1,y=-3..2);
>
# Now on to the tangent plane function
#  at (x0,y0):
> Tg:=(x,y,x0,y0)->g(x0,y0)+D[1](g)(x0,y0)*(x-x0) + D[2](g)(x0,y0)*(y-y0);
# The tangent plane:
> Tg(x,y,2,1);
# Cut by the plane x=2:
> plot({g(2,y),Tg(2,y,2,1)},y=-3..3);
# Cut by the plane y=1:
> plot({g(x,1),Tg(x,1,2,1)},x=-3..3);
# View the following plot of g and its tangent plane
# from different angles, and with different colorings and
# styles.
> plot3d( {g(x,y),Tg(x,y,2,1)},x=-3..1,y=-3..2);
# We need to load a special package to do the next animation:
> with(plots):
# Animation is like a sequence of cuts by planes y = constant
> animate({g(x,y),tg(x,y)}, x=-3..3,y=-3..3);
# or x = constant.
> animate({g(x,y),tg(x,y)}, y=-3..3,x=-3..3);
> plot3d((x^2-y^2)/(x^2+y^2), x=-3..3, y=-3..3, grid=[49,49]);
# This last function is discontinuous at (0,0).
# Can you describe the surface?  Go back on your Maple worksheet
# to the definition of  g  and replace it by
> g:=(x,y)->x^2 + y^2;
# or something else.
# Then press ENTER to repeat each step of the
# worksheet for this new function.

Back to Maple Assignment Cover Page