% maple lab1 Spring 2006
\documentclass[leqno]{article}
\input{linalg.sty}
\def\MAPLE{{\tt Maple}}
\def\rf#1{(\ref{#1})}
\def\Prob#1#2{\par\bigskip\par\noindent
{\large\sf Problem #1}. {\bf #2}\par}
\parskip=3pt
\def\MAPLE{{\tt maple}}
% \begin{topics}{template} ... \end{topics}
% used like enumerate, itemize, description environments
% The item[] is never optional!
%
\iffalse
\newcommand{\topicslabel}[1]{\mbox{#1}\hfil}
\newenvironment{topics}[1]{
    \begin{list}{}{%
      \let\makelabel\topicslabel
      \settowidth{\labelwidth}{\topicslabel{#1}}
      \setlength{\leftmargin}{\labelwidth}
      \advance\leftmargin by 1.5em}
}{\end{list}}
\fi
\pagestyle{plain}
\setlength{\textheight}{9.8in}
\begin{document}
\thispagestyle{empty}
 {\bf Name~}\underline{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\hfill
 {Class Time~}\underline{~~~~~~~~}\newline


\begin{center}
\bf Math 2280 Maple Project 1 \\
{\small\bf January 2006}
\end{center}


{\bf Due date}: See the internet due dates. Maple lab 1 has two
problems L1.1, L1.2.

{\bf Submitted work}. Please submit one stapled package, the top
sheet handwritten. The final pages are appendices made by printing
one or more maple work sheets. Hand work should do the steps shown
in examples below. Maple code is expected to parallel the code
given in the examples below.


{\bf Tutorials}. Students without maple exposure should attend one
of the Tutoring Center's maple tutorials in the second week of the
semester. See the web page for scheduled times, posted after week
two. The brave may start their own tutorial by attempting this lab
unaided or by starting with the maple online tutorial; see Example
3 below.


{\bf References}: %Edwards-Penney, pages 55--57.
Code in \MAPLE{} appears in \verb|2280mapleL1-S2006.txt| at URL
\verb|http://www.math.utah.edu/~gustafso/|. This document:
\verb|2280mapleL1-S2006.pdf|.

\smallskip

\Prob{L1.1}{(Quadratic equation)} Solve the quadratic equation
$ax^2+bx+c=0$ and display its factorization:
\newline
 (A) $a=8$, $b=22$, $c=15$;
\newline
 (B) $a=2$, $b=4$, $c=12$;
\newline
 (C) $a=1$, $b=8$, $c=16$.
\newline
In your solution, show the {\bf solution steps by hand} and also
the \MAPLE{} code which checks the answer.

\Prob{L1.2}{(Functions and plotting)} Define the following
functions and plot domains, then plot them.
\newline (A) $\sin(3\pi x)$, $0\le x \le 1$.
\newline (B) $|5\ln(2+x)-2|$,$-1\le x \le 2$.
\newline (C) Let $a=4$, $b=12$,
$c=\pi/12$, $t_0=15$. Plot $a+b\cos(c(t-t_0))$, $0\le t \le 72$.
\newline (D) $\sinh(\sin(\theta)+\cos(\theta))$, $-\pi \le \theta \le \pi$.
In your solution, show only the maple code and the graphics.
Please shrink the graphics to $2\times 2$ inches, before printing.
% a:=4; b:=12; c:=Pi/12; t0:=15; g:=unapply(a+b*cos(c*(t-t0)),t);
% plot(g(t),t=0..72);
\medskip

\vfill

{{\bf Start the hand solution on this page.} {\sf Staple this page
on top of the maple work sheets.} \newline
\medskip
Examples on the next page \ldots}
\newpage


{\bf Example 1}. {\large\sf Solve $x^2+4x+6=0$ by hand and check
using \MAPLE{}}.

{\bf Solution}: The square-completion $(x+2)^2+2=0$ gives
conjugate roots $x=-2+\sqrt2i$, $x=-2-\sqrt2i$. The factorization
is $(x+2-\sqrt2i)(x+2+\sqrt2i)=0$. The roots may also be found
from the quadratic formula, in which case the root and factor
theorems of algebra apply to translate each root $x=r$ into a
factor $x-r$ of the quadratic equation. The \MAPLE{} code which
checks it is
\begin{verbatim}
 eq:=x^2+4*x+6:
 ans:=[solve(eq=0,x)];
 eq1:=(x-ans[1])*(x-ans[2])=0;
 expand(eq1);
\end{verbatim}
Notation: Square brackets delimit an array, e.g., \fbox{\tt
F:=[-1,3,5];} defines array {\tt F} with three elements $-1$, $3$,
$5$. Symbol \fbox{{\tt F[1]}} extracts the first element from
array {\tt F}, while \fbox{\tt F[2]} extracts the second element.
Get \MAPLE{} help from \fbox{\tt ?solve}, \fbox{\tt ?expand} and
\fbox{\tt ?factor} entered into a \MAPLE{} worksheet.

\medskip

{\bf Example 2}.  {\large\sf Define a function $y=x^2+5x+6$ on $-4
\le x \le -1$ using \MAPLE{} and plot it}.

{\bf Solution}: The \MAPLE{} code which applies is
\begin{verbatim}
 f:=unapply(x^2+5*x+6,x): a:=-4: b:=-1:
 plot(f(x),x=a..b);
\end{verbatim}
The construct \fbox{\tt f:=unapply(x$\hat{~}$2+5*x+6,x)} is an
inline function definition. Subsequent use of the symbol {\tt f}
requires two parentheses and a function argument, e.g., {\tt
f(x)}, {\tt f(-1.1)} are valid. Get help by entering \fbox{\tt
?unapply} and \fbox{\tt ?plot} into a \MAPLE{} worksheet.

The inline function definition \fbox{\tt
f:=x-$>$x$\hat{~}$2+5*x+6} uses a minus sign (-) and a greater
than sign ($>$) to separate the variable name ($x$) from the
function definition ({\tt x$\hat{~}$2+5*x+6}). This alternative
construction may appear in later maple code. In this elementary
example, there is no difference between the two constructs. The
maple function \fbox{\tt unapply} is more robust and produces
fewer surprises for novices.

\medskip

{\bf Example 3}. Run the \MAPLE{} tutorial in \MAPLE{} versions 6,7,8,9.

{\bf Solution}: In a \MAPLE{} worksheet, enter \fbox{\tt ?newuser} and
choose the {\em New User's Tour}. In the tour, you will learn some basics
of \MAPLE{}.
\bigskip

{\bf Hint on L1.2}: Investigate the help panels for \fbox{\tt
cos}, \fbox{\tt abs}, \fbox{\tt exp}, \fbox{int} and \fbox{Int}
~(the inert version of \fbox{\tt int}). Direct use of \fbox{\tt
int} in plot commands can produce unexpected results without any
error message. The constant $\pi$ is coded in \MAPLE{} as
\fbox{\tt Pi}, the upper and lowercase letters being significant.
A common error is to code \fbox{\tt c=Pi;} instead of the correct
\fbox{\tt c:=Pi;}. The error message {\em empty plot} can mean
that a variable name is undefined. For example, \fbox{\tt
plot(x+PI,x=0..1);} will not plot. To see why, use \fbox{\tt
p:=plot(x+PI,x=0..1);} to display the plot data. The offending
variable name is {\tt PI} (different than {\tt Pi} or {\tt pi}).

{\bf End of Maple Lab 1.}

\end{document}
