\magnification = \magstep1
\centerline{Mathematics 41, section 1 -- Analysis 3}
\centerline{Lab Day 1 -- Getting Acquainted With Sun/Unix, 3D Plotting}
\centerline{September 15, 1999}
\bigskip
\noindent
There is additional information about Maple commands, etc. in the
Damiano and Freije {\it Collaborative Learning Manual}.  You will
probably want to consult that in addition to the information here,
especially on later lab assignments.
Some general information about the Unix operating system is 
available from a link on the course homepage.
\bigskip
\noindent
{\it Running Maple in SW 219}
\bigskip
The machines in SW 219 are powerful Sun workstations.  The
operating system running on them is called {\it Unix\/}.  Unix is the 
operating system of choice for many mathematicians and most computer 
scientists for their own work.  It was designed from the start with networks 
in mind, so it is generally much more reliable than the Microsoft Windows 
95, 98, and NT operating systems commonly used on PC's.  There is also a 
version of Unix called {\it Linux} that is available (free) for PC's.  
Depending who you listen to, Linux/Unix may be the ``wave of the future'' on 
PC's too!


To run Maple on the Sun workstation network:
\bigskip
\item{1)} Log onto any machine using the username/password (Note:
this is {\it not} your campus network username/password).  The Sun
workstation network is connected to, but separate from, the rest of 
the campus network.
\item{2)} Open a {\it Terminal\/} window using the Workspace Menu (to
get this place the cursor over the desktop background and press
the {\it right} mouse button), 
\item{3)}  Type in {\tt xmaple \&} at the command prompt (the computer name,
followed the \% sign) in the Terminal window.
\bigskip
\noindent
(The {\tt xmaple} part should 
be more or less self-explanatory; the ampersand {\tt \&} means that Maple
will be run in an independent window, and the Terminal
window will be available for you to input additional commands, etc. 
If you omit the ampersand, the Terminal is not usable this way while
Maple is running.)  Take a moment to look over the Maple window and 
note its features.  (If you have used Maple in the HA 408 PC lab, you will
see that this user interface is almost exactly the same.)  
The ``subwindow'' marked Untitled (1) opened inside it is a 
blank {\it Maple worksheet\/}.  
\bigskip
\noindent
{\it Maple Worksheets}
\bigskip
Worksheets are integrated text/graphics/mathematics
documents where any or all of the following can be done: 
\medskip
\itemitem{a)} you can type in commands from the keyboard to ask Maple to 
perform many different kinds of calculations, read data
from external files, store work in files, etc.
\itemitem{b)}  output generated by Maple from your input
commands (numerical values,
symbolic formulas, and graphics) will be displayed, 
\itemitem{c)} you can modify commands, generating new output, store
your results for use later, etc.    
\itemitem{d)} you can enter text to annotate and explain the 
results of computations.
\medskip
\noindent
Much of your interactive ``management'' of a worksheet in progress
will take place through the File, Edit, View, Insert, etc. pull-down menus 
across the top of the Maple window, the ``tool bar'' below that with 
the button icons for various operations (can you guess what each of 
them does?), and the ``scroll bar'' on the right that you can use to move 
around within the worksheet, to see previous input and output lines, etc. 
Most of the common operations appear both as items in one of the 
pull-down menus and as toolbar buttons.  The toolbar buttons are
faster to use, but somewhat limited in the options they offer, so 
you will want to have a general idea what is accessible from 
where in the pull-down menus also.
\bigskip
\noindent
{\it Input and Text Regions in a Worksheet\/}
\bigskip
A new worksheet window will be labeled something
like Untitled (1).  On the first
line of the worksheet, there is a $[>$ in black.  This 
is the Maple {\it input prompt} -- the signal that Maple
is ready to accept a command from you and try to execute it.
A new input prompt will be generated automatically in a worksheet each time 
you enter a command and execute it {\it at the end of a worksheet in 
progress\/}. You can also go back and insert new commands and output 
at any point in a worksheet as follows.  You can {\it insert an input 
prompt\/} and an input region at any point in the worksheet by  
placing the cursor at the desired location and
pressing the toolbar button marked with $[>$.  (After executing
an inserted command like this, Maple will drop to the 
next input line, so to insert several input lines in the
middle of a worksheet, you will need repeat the above.) 
  
As we mentioned before, Maple worksheets can contain text
as well as commands and output.  To create a text region you can 
press the $[>$ button above, then the
button marked by a capital T (this changes the region into 
a text region).   Any text can now be entered, and this will
be treated as an ``inert'' comment.  That is, it will appear as
you enter it when you print out the worksheet, and it will
not be treated as Maple input.  After you create a text region,
if you press  the capital sigma ($\Sigma$) 
toolbar button with the cursor placed on that region, you 
can type in a Maple expression in input
format, and have it displayed (in ``inert'' form)
in usual mathematical notation (with 
raised exponents, no asterisks for multiplication, etc.  This is 
sometimes useful for creating ``pretty'' worksheets!

\bigskip
\noindent
{\it Saving and Reloading your Maple Worksheets}
\bigskip
When you begin working on a
worksheet, you will usually want to {\it save your work\/} every
once in a while in case
a computer problem develops, or in case
you need more than one lab session to complete the work you are
doing.  
\bigskip
\item{1)} Select the SAVE option from the FILE
pull-down menu, or press the tool bar button that looks like
a 3 1/2 ``floppy'' diskette.
\item{2)} If you are saving your work for the first time, 
you will see a SAVE AS dialog box.  Go to the Filename box, and 
type in a name for the file where the worksheet will be 
stored (any string of letters and digits -- no spaces -- is OK) type 
in a period after the file name you chose and then the ``extension'' 
{\it mws\/}
for {\it Maple Work Sheet\/}.  For instance, a good choice 
might be something like {\it lab1.mws\/}.  Then click the 
OK button to write the worksheet to the network drive.
(You will only need to type the filename once in a session.
Subsequent saves just update the file.  To save the worksheet
in a new file (for instance with a different name), use the SAVE AS
option.)
\item{3)}  On the Sun workstation network, worksheets are saved
to your space on a shared network hard disk drive.  You can access
these again from any one of the workstations in SW 219, or any of 
the Sun workstations in the Math/CS department.  {\it But note:  This 
storage is separate
from your p: drive on the campus network, and you will not be able to 
read files from your p: drive in SW 219.}
\item{4)}  To update the worksheet further in a later session,
you can read the worksheet back into Maple using the OPEN
option from the FILE Menu, or the ``open'' toolbar button.  Get into Maple 
as above,  
and select OPEN from the FILE Menu.  Maple will prompt you as above for the
name of the worksheet with a dialog box very like the SAVE AS
box described above.  Highlight 
the worksheet you want, and click OK.  IMPORTANT NOTE:  When
you read a previously created worksheet into a new Maple session, you 
{\it have not actually executed any of the commands in it in the 
new session\/}.  If you want to make use of any results in that
worksheet, you will need to execute the commands again.  In the 
EDIT pull-down menu, you will see an EXECUTE option that lets you 
recompute an entire worksheet or a section of one.
 You can also press
RETURN on selected input lines to do the same thing.
\bigskip
\noindent
\bigskip
\noindent
{\it Printing}
\bigskip
To print a file in SW 219, use the printer toolbar icon.  In the Printer
Setup form, the settings will need one adjustment -- make sure the 
Print Command button is depressed, and change the print command
line in the box next to it to:
{\tt lp -d hso\_219\_hp4000}.  (The characters after the o and the 9
are ``underscores''.) After you press Print, the output 
will be routed to the network printer in SW219 for you to pick up.
\bigskip
\noindent
{\it Getting Out}
\bigskip
When you leave, quit the Maple window (FILE/EXIT). Then log out from
the Sun network (either the Log Out option from the Workspace menu, or 
the EXIT button on the Workspace toolbar).  DO NOT TURN THE WORKSTATION
OFF.  THESE ARE LEFT POWERED UP AT ALL TIMES.
\bigskip
\noindent
\bigskip
\noindent
{\bf A First (or New) Maple Command}
\bigskip
Today, we will be using the {\tt spacecurve} command in the {\tt plots}
package to draw line segments in 3D, using the vector form 
for lines we have discussed in class.  Begin your Maple 
session by entering the command:
\medskip
\centerline{\tt with(plots);}
\medskip
\noindent
This loads a package of plotting routines, including the {\tt spacecurve}
command that you should see in the list of command names generated
by the {\tt with(plots);}.  

The {\tt spacecurve} command can be used to plot any parametric curve
in ${\bf R}^3$.  The format for the command is
\medskip
\centerline{\tt spacecurve([x(t),y(t),z(t),t=a..b]);}
\medskip
\noindent
where $x = x(t)$,$y = y(t)$,$z = z(t)$ are the parametric equations of 
the curve and the range of parameter values to be plotted is 
$a \le t \le b$.  (Note the placement of the square brackets -- the
format here is not flexible!) 
For instance, try entering the input command
\medskip
\centerline{\tt spacecurve([1-t,2*t,3-4*t,t=0..1]);}
\medskip
\noindent
This plots the portion of the line through the point $P = (1,0,3)$
with direction vector $\vec{v} = (-1,2,-4)$ for $t$ in $[0,1]$, since
$$(1,0,3) + t(-1,2,-1) = (1-t,2t,3-4t).$$
The asterisks in the components of the input above are Maple's symbol
for multiplication.  The are {\it not optional\/} -- in any formula
involving a product, you will need to put in the $\ast$ symbol
explicitly.


Type in this command line (exactly as here) and
press RETURN. If you make a typing mistake, Maple will let you know about
it(!).  Fortunately, if this happens, the whole command does {\it not} need to
be re-entered. Just move the cursor arrow to the place on the input line
you want to change, press the left mouse button, and edit the input as
needed. Typing from the keyboard will {\it insert} new stuff at the cursor
location; the DELETE and BACKSPACE keys will remove stuff (DELETE removes
the character in front of the ``insert point''; BACKSPACE removes
the character in back). You can also move around on the input line with
the arrow keys if more than one thing needs to be changed.  When you think
it is OK, press RETURN again to have Maple execute the command again.
The first plot you see here will be rather uninformative. Fortunately, Maple
also lets you add axes and look at a 3D plot from different viewpoints. 
Here's how:
\bigskip
\item{1)}  Click the left mouse button once over the graph.  This 
should bring up a ``bounding box'' for the graph with corners you 
can {\it drag and drop\/} with the mouse to resize the graph. 
\item{2)}  If you place the mouse over the graph now and hold the left
button down, when you move the cursor, you should see a box rotating
following the cursor position.  Release the left mouse button 
when you get to the position you want.
\item{3)}  If you click  
the right mouse button, you will bring up a menu containing the options
{\tt Redraw, Copy, Style, Axes, Color} and several others.  Select
{\tt Axes, Normal} with the left mouse button. Then repeat clicking the 
right mouse button and select {\tt Redraw}.
\bigskip
\noindent
Practice a few times repositioning the viewpoint (rotating 
the viewing box) and redrawing the graph.  

To draw several parametric curves in the same graph, you can include
several curve specifications in the form {\tt [x(t),y(t),z(t),t=a..b]} 
between curly braces {\tt $\{$,$\}$}, separated by commas inside the 
parentheses for the {\tt spacecurve\/} command.

\bigskip
\noindent
{\bf Lab Exercise}
\bigskip
The points $P = (0,0,0)$, $Q = (2,0,0)$, $R = (0,\sqrt{3},1)$, 
$S = (0,-1,\sqrt{3})$
are four corners of a cube in ${\bf R}^3$
with edges $PQ$, $PR$, and $PS$, because
the vectors $\vec{u} = Q-P, \vec{v} = R-P, \vec{w} = S-P$
all have magnitude 2, and
$\vec{u}\cdot\vec{v} = \vec{u}\cdot\vec{w} = \vec{v}\cdot\vec{w} = 0$.
Your assignment, should you decide to accept it (just kidding!), is to 
create a picture of this cube by drawing the 12 edges together on the 
same set of axes in ${\bf R}^3$ (begin by drawing the line segments
from $P$ to $Q$, $P$ to $R$, and $P$ to $S$).  Also give a full
explanation how you found the other corners of the cube and the remaining
segments.  This can be done in a text region (see information above
for how to insert text regions in a worksheet).
\bigskip
\noindent
{\it Assignment}
\bigskip
For this lab, we will be doing {\it individual writeups\/}
due Monday, September 20.
\bye

