\documentstyle [12pt]{report}
\setlength{\topmargin}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\footskip}{0in}
\setlength{\footheight}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\textheight}{9in}
\setlength{\textwidth}{6.5in}
\begin{document}
Math 314H Computer Project 1 \hfill Due: Friday, February 15

Instructor: Thomas Shores

Subject: Heat Flow in an Insulated Rod \hfill Points: 20


\vspace{8pt}
{\it Description of the problem:}
You are working for the firm Universal Dynamics on a project which has
a number of components.  You have been assigned the analysis of a
component which is similar to a laterally insulated rod.  The problem
you are concerned with is as follows: part of the specs for the rod are
that no material which will stay at temperatures above 60 degrees
Celcius for a long period of time at any point will be acceptable.  You
must decide if any of the materials listed below are acceptable and
write a report on your findings.  You may assume that the rod is of
unit length.  Suppose further that internal heat sources come from a
position dependent function $f(x)$, $0 \leq x \leq 1$ and that heat is
also generated at each point in amounts proportional to the temperature
at the point.  Also suppose that the left and right ends of the rod are
held at 0 and 50 degrees Celcius, respectively.  When sufficient time
passes, the temperature of the rod at each point will settle down to
``steady state'' values, dependent only on position $x$.  These are the
temperatures you are interested in.  It can be shown from physical
principles that if $u$ is the temperature function of the rod, i.e.,
$u(x)$ is the temperature of the rod at $x$, then $u(x)$ and $f(x)$ are
related by the following boundary value problem (BVP):

\begin{eqnarray*}
-k\,d^2u/dx^2 + s\,u(x) & = & f(x), \\
u(0) & = & 0, \\
u(1) & = & 50.
\end{eqnarray*}

Here k is a constant, called the {\it thermal conductivity} of the rod,
associated with the material of the rod and s is another constant.  For
your problem take $f(x) = 200 \cos(x^2)$ and $s = 0.4$.  Here are the
conductivity constants for the materials which your company is
considering building the rod with.  Which are acceptable?

\vspace{12pt}
Platinum: $k = .17$

Zinc: $k = .30$

Aluminum: $k = .50$

Gold: $k = .75$

Silver: $k =  1.00$

\vspace{12pt}
{\it Procedure:} For the solution of the problem, formulate a discrete
approximation to the BVP similarly to what was done in class.  Choose
an integer $n$ and divide the interval [0, 1] into $n+1$ equal
subintervals with endpoints $0 = x_0, x_1, ...  ,x_{n+1} = 1.$ Then the
width of each subinterval is $h = 1/(n+1)$.  Next let $u_i$ be our
approximation to $u(x_i)$ and replace the second derivative in the
equation $-u''(x_i) + (s/k)u(x_i) = f(x_i)/k$, $i = 1,...n$ by the the
approximation to the derivative $u''(x_i) \approx (u_{i-1} - 2u_i +
u_{i+1})/h^2$.  There results a linear system of $n$ equations in the
$n$ unknowns $u_1, u_2,...,u_n.$

For this problem divide the rod into 15 equally sized subintervals and
take $n = 14$.  Use the largest $u_i$ as an estimate of the highest
temperature at any point in the rod.  You might want to use a larger n,
too, to corroborate your findings.

{\it Implementation Notes:} Set up the coefficient matrix $a$ and right
hand side $b$ for the system.  The coefficient matrix should be a
tridiagonal matrix with $(2 + h^2s/k)$'s down the main diagonal, -1's in the
two off diagonals and 0's elsewhere.  Both the coefficient matrix and
the right hand side can be set up using the Table command of
Mathematica.

For $b$: \begin{verbatim}100 h^2 Table[Cos[(i h)^2], {i,n}] / k
\end{verbatim} will generate $b$, except for the last coordinate.  Use
b[[14]] = b[[14]] + 50 to add $u(1)$ to the right hand side of the
system and get the correct $b$.

For $a$: \begin{verbatim}
Table[Switch[i-j,1,-1,0,2+h^2*s/k,-1,-1,_,0],{i,n},{j,n}] \end{verbatim} will
generate a tridiagonal matrix of the desired form.  (See page 438 of
{\it Mathematica} for an explanation, or better yet, use the on line
help for all commands you want to know more about.)

For floating point numbers:  we want to simulate ordinary floating point 
calculations on Mathematica.  You will get some symbolic expressions 
which we don't want, e.g., for $b$.  To turn $b$ into floating point 
approximations, use: b = N[b].  The N[ ] function turns the symbolic 
values of b into numbers, with a precision of about 16 digits if no 
precision is specified.  Do this before you solve any systems.

For solving linear systems: u = LinearSolve[a,b] will solve 
the system $a*u = b$ and store the result in $u$.

About vectors: Mathematica does not distinguish between row vectors or 
column vectors unless you insist on it.  It knows how to multiply matrix 
a by vector x (either $a . x$ or $x . a$) without your having to turn 
$x$ into a row or column.

{\it About reports:} The first thing you need to know about report 
writing is the intended audience.  You may assume that this report will 
be read by your bosses, who are technical people such as yourself. 
Therefore, you should write a brief statement of the problem and 
discussion of methodology.  You may assume the physics of this problem 
is as given above without further justification, but in real life you
would be expected to offer some explanation of physical principles you
employ.  Another good thing to have in mind is a target length for your
paper.  Do not clutter your work with long lists of numbers and try to
keep the length of this report at 4 or fewer pages of text.

Most kinds of discourse should have three parts: a beginning, a middle
and an end.  Roughly, a beginning should consist of introductory
material.  In the middle you develop the ideas described or theses
proposed in the introduction, and in the end you summarize and tie up
loose ends.  Of course, rules about paper writing are not set in
concrete, and authors vary on exactly how they organize papers of a
given kind.  Also, a part could be quite short; for example, an
introduction might only be a paragraph or two.  Here is a sample
skeleton for a report (perhaps rather more elaborate than you need): 1. 
Introduction (title page, summary and conclusions), 2.  Main Sections
(problem statement, assumptions, methodology, results, conclusions), 3. 
Appendices (such as mathematical analysis, graphs, possible extensions,
etc) and References.

{\it References:} 1. Gilbert Strang, {\it Linear Algebra and Its 
Applications}, San Diego: Harcourt Brace Janovich, Publishers, 1988, pp. 
52-53.

2. Eric Becker, Graham Carey and J. Tinsley, {\it Finite Elements: An 
Introduction, Volume I}, Englewood Cliffs, New Jersey: Prentice Hall, 
Inc., 1981, pp. 42-47.

\vspace{12pt}
{\it Special Thanks:} To Stephanie Fitchett, who designed this project 
while she took 314H in 1989.

\end{document}

