% Copyright The Numerical Algorithms Group Limited 1991. % Certain derivative-work portions Copyright (C) 1988 by Leslie Lamport. % All rights reserved % Title: 3-D Graphics % Address comments and questions to the % Computer Algebra Group, Mathematical Sciences Department % IBM Thomas J. Watson Research Center, Box 218 % Yorktown Heights, New York 10598 USA % Author: Clifton J. Williamson % Date created: Memorial Day 1990 % Date last updated: same \begin{page}{ExPlot3DFunctions}{Plotting Functions of Two Variables} \beginscroll To plot a function {\em z = f(x,y)}, you need only specify the function and the intervals over which the dependent variables will range. For example, here's how you plot the function {\em z = cos(x*y)} as the variables {\em x} and {\em y} both range between -3 and 3: \graphpaste{draw(cos(x*y),x = -3..3,y = -3..3)} \endscroll \autobuttons\end{page} \begin{page}{ExPlot3DParametricSurface}{Plotting Parametric Surfaces} \beginscroll To plot a parametric surface defined by {\em x = f(u,v)}, {\em y = g(u,v)}, {\em z = h(u,v)}, specify the functions {\em f(u,v)}, {\em g(u,v)}, and {\em h(u,v)} as arguments of the function `surface', then give the intervals over which {\em u} and {\em v} are to range. With parametric surfaces, we can create some interesting graphs. Here's an egg: \graphpaste{draw(surface(5*sin(u)*cos(v),4*sin(u)*sin(v),3*cos(u)),u=0..\%pi,v=0..2*\%pi)} Here's a cone: \graphpaste{draw(surface(u*cos(v),u*sin(v),u),u=0..4,v=0..2*\%pi)} \endscroll \autobuttons\end{page} \begin{page}{ExPlot3DParametricCurve}{Plotting Parametric Curves} \beginscroll To plot a parametric curve defined by {\em x = f(t)}, {\em y = g(t)}, {\em z = h(t)}, specify the functions {\em f(t)}, {\em g(t)}, and {\em h(t)} as arguments of the function `curve', then give the interval over which {\em t} is to range. Here is a spiral: \graphpaste{draw(curve(cos(t),sin(t),t),t=0..6)} Here is the {\em twisted cubic curve}: \graphpaste{draw(curve(t,t**2,t**3),t=-3..3)} \endscroll \autobuttons\end{page}