\documentclass[12pt]{article}
\usepackage{latexsym,amsmath,epic,eepic}

\pagestyle{empty}
\setlength{\topmargin}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}

\begin{document}
\begin{center}
\textbf{Holy Cross College, Fall Semester, 2003} \\
\textbf{Math 131, Lab \#1, Wednesday, September 17} \\
Professor Hwang \\
\end{center}

\paragraph{Introduction} 

Maple is a powerful symbolic manipulation and graphing program that is
available on the PCs in Haberlin~408 and on the campus Unix machines.
This lab will introduce you to some of Maple's basic graphing
capabilities and help you visualize some of the properties of
functions we've seen so far.

Maple has a built-in programming language, and is largely interactive
via a \emph{prompt}; you type commands into Maple and it performs some
task in response. To save you the trouble of typing many commands
(whose syntax can seem strange at first), there is a Maple
``worksheet'' at
\begin{center}
\verb+  http://mathcs.holycross.edu/~ahwang/teach/131/lab01.mws+
\end{center}

Begin by logging on to one of the PCs in the lab and clicking on the
Maple icon. Maple will open a browser-like window when it starts up.
Click on the ``file'' button to get a drop-down menu, and select
``open URL''. Use the URL of the worksheet.

Each line of the worksheet is either a function definition or a
plotting command. Place the cursor on the first line and hit
\texttt{return} to load the function definitions. Place the cursor on
a \texttt{plot} command and hit \texttt{return} to plot the given
functions. 

If you change the definition of some function, you must re-enter the
function and everything that depends on it by hitting \texttt{return}
on the corresponding lines of the worksheet. Maple does not
automatically update function definitions.

\paragraph{About Functions} 

A function is a \emph{procedure}. For example, if $f(x)=x^2$, then~$f$
is the ``squaring procedure'', which takes a real number as input and
returns the square. Note carefully that while~$f$ represents the
squaring function, $x^2$~\textbf{does not}!  The reason is that there
is nothing special about the letter~$x$; to a computer, the
expression~$x^2$ simply represents the square of the number~$x$. Said
another way, the computer does not know that~$x$ is a ``variable'';
you must tell the computer that~$x$ is the variable if that is what
you want. One way to do this is to write $x\mapsto x^2$; this is
reasonable notation to denote the \emph{procedure} of squaring a
number. Observe that $t\mapsto t^2$ represents \emph{exactly the same
  function}. Changing the notation for the input variable has no
effect on the procedure. The more accustomed you get to this sort of
thing, the better.

If~$f$ is a function, then~$f(x)$ is the value of the function at~$x$,
which is a \emph{number}. Informally, many people are careless about
the distinction (for example, we often say, ``the function~$e^x$'',
when we really mean ``the function~$\exp$'' or ``the procedure
$x\mapsto e^x$''), but it is crucial to be aware that a function and
its value at a general point are not the same thing.

\paragraph{Punctuation and Maple Grammar}

Computers, which are good at following unambiguous, literal
directions, must have everything spelled out for them. Maple, unlike
some popular software, is \emph{case sensitive}, meaning capital
letters are not the same as lower-case letters; \texttt{Pi}~and
\texttt{pi} are not the same thing. Maple uses commas to separate
items in a list, a pair of periods to specify domains for plotting,
round parentheses to group arguments of functions, curly braces to
group items together (such as several functions for plotting) to make
one logical item, and semicolons to end its sentences. It is best to
put at most one command per line, to avoid the possibility of a
``run-on'' sentence, where you type a comma instead of a semicolon.

Maple requires an explicit~``$*$'' to denote multiplication; a common
error is to type~\texttt{2x} instead of~\texttt{2*x}. Aside from this,
Maple handles algebraic expression pretty much as you learned in
elementary school: Exponents are evaluated first, then multiplication
and division (read left to right), and finally addition and
subtraction (again read left to right).

In contrast to its pickiness with punctuation, Maple is flexible about
spaces, tabs, and \texttt{return} characters. You may use these freely
between words to make your input lines easier to read. (Don't go
overboard, though; \texttt{si n} and \texttt{sin} are not the same
thing.)

\paragraph{Defining Functions in Maple}

Mathematicians use the symbol ``$:=$'' to mean ``is defined to be''.
With this fact and the previous paragraphs in mind, Maple's syntax for
a function definition should make more sense:
\begin{verbatim}
  f := x -> x^2;
\end{verbatim}
is a Maple sentence that defines~\texttt{f} to be the squaring
procedure. Once you have made this definition, you may use~\texttt{f}
anywhere you want to refer to the squaring procedure. For example, to
define $g(x)=(1+x^2)^2$ in Maple, you could type
\begin{verbatim}
  g := x -> f(1+f(x));
\end{verbatim}
As you may have noticed, if you then change the definition
of~\texttt{f}, the definition of~\texttt{g} \emph{does not} automatically
change; you must go back to the line defining~\texttt{g} and type
\texttt{return} again. (Note, that the cursor need not be at
the end of the line when you type \texttt{return}.)

Maple already knows many functions by name; you may type
\begin{verbatim}
  f := cos;  g := exp;  L := ln;
\end{verbatim}
instead of the longer (but equivalent)
\begin{verbatim}
  f := x -> cos(x); g := x -> exp(x);  L := x -> ln(x);
\end{verbatim}

\paragraph{Plotting}

Plotting will be our main use of Maple, so it is worth saying a bit
about plotting syntax. ``\texttt{plot}'' is itself a procedure, which
takes (as input) a list of functions and an interval of inputs (and
possibly outputs), and returns a plot. (Abstractly, this \emph{is} a
kind of function, yes?)

A simple example of a \texttt{plot} command is
\begin{verbatim}
  plot(sin, -0.001 .. 0.001);
\end{verbatim}
which plots the sine function over the interval $[-0.001,0.001]$. Note
that no~\texttt{x} has been used, as the name of the variable is
immaterial. If you prefer, you can type
\begin{verbatim}
  plot(sin(x), x = -0.001 .. 0.001);
\end{verbatim}
with the same result.  Pick the form you like and stick with
it. However, you must be careful not to mix these forms; the lines
\begin{verbatim}
  plot(sin(x), -0.001 .. 0.001);
  plot(sin, x = -0.001 .. 0.001);
\end{verbatim}
will give empty plots.

If the vertical scale of a plot is not to your liking, you can force
Maple to use a particular interval, as in
\begin{verbatim}
  plot(sin(x), x = -0.001 .. 0.001, y = 0 .. 0.001);
\end{verbatim}
For safety, write decimal fractions as $0.001$ rather than $.001$; the
leading~0 will help prevent both you and Maple from becoming confused.

The general form of a \texttt{plot} command is:
\begin{verbatim}
  plot( <function list>, <plot intervals> );
\end{verbatim}
To create a function list, group the functions with square brackets to
create a single \texttt{plot} object. For example,
\begin{verbatim}
  plot([sin(x), cos(x)], x = -Pi .. Pi, y = -2 .. 2);
\end{verbatim}
plots the sine and cosine functions over the interval $[-\pi,\pi]$,
with vertical scale $[-2,2]$.

\eject

\end{document}