WELCOME TO
Numerical Linear Algebra!
Office Hours during the 1/2004-4/2004 term: MWF 10-10:40,
and by appointment.
Also, if I'm in, you are welcome to come by!!!
I. Course Syllabus
Math 1080 11-11:50 MWF, CRN 27589
Note Room Change:
Monday and Friday: Thackery Hall 525
Wednesday: Public Health A216
Office Hours during the 1/2004-4/2004 term: MWF 10-10:40,
and by appointment.
Also, if I'm in, you are welcome to come by!!!
This course in NLA is for students interested in solving scientific
and engineering problems which involve lots of data and more than one
dimension.
Basically, any such problem reduces eventually to one in numerical linear
algebra.
Text: Lecture Notes in Numerical Linear Algebra, by W Layton,
We will work out a way to let everyone get a copy efficiently. It is
presently about 170 pages. About 40 typed and the rest carefully
handwritten.
I hope that more will be typed as the course goes on. If so, Ill
distribute
these in class.
Instructor: W. Layton, Ty 603,412-624-8312,
(math office:412-624-8375) email: wjl@pitt.edu.
Grader:TBA
Programming: NLA is a hands on/skills topic. One important
skill is the use of MATLAB to solve problems. Matlab is EASY! In the
sophomore
course , Math 0250, students are expected to learn it and use it without
instruction (and they do-with success)!
Another skill is running and modifying another program in a lower
level
language. I DONT assume you know much about programming. I DO
assume
you can learn MATLAB on your own and that you are intelligent and can
think
algorithmically. Ill teach one language in class; by the end you should
feel pretty OK in modifying a working program in it.
Course Grade:= [Exam1+Exam2+Exam3+Final Exam + HW Grade]/4,
EXAM1 is: MONDAY 1/26/2004
EXAM2 is: WEDNESDAY 2/18/2004
EXAM3 is: WEDNESDAY 3/24/2004
NOTE new day for exam 3!!
letter grades will be converted to the standard scale 90=100=A,
80 89=B, 70-79=C, 60-69=D 0-59=F for averaging.
Make Up Exams- will NOT be given. Notify me BEFORE the exam if
you cannot be there for a reason which is URGENT,NECESSARY and BEYOND YOUR
CONTROL.
Other Books: Seeing something from different points of view can
be useful. Here are some books can recommend (but only if you can find
them CHEAP):
C. Cullen, An intro. to NLA, this used to be the textbook. Its still
an excellent book to read and have as a resource. (We are trying something
different because its at a very high mathematical level nd because a more
algorithmic treatment is useful.)
C. F van Loan, Intro. To Scientific Computing,excellent , about our
level.
D Young and R Gregory,A survey of numerical math, vol I and II, good
, higher level, older notation that some find difficult.
G Golub and C van Loan, Matrix Computation., A classic, higher level.
G Strang, Linear Algebra and its Applications, general linear algebra
G Strang, Intro to Applied Math., another interesting book of Strang
that overlaps our course significantly.
D Luenberger, Optimization by vector space methods,
excellent treatment of CG methods and many topics we dont cover
R Horn and R Johnson, Matrix Analysis, only matrix theory, excellent!
D Higham and N Higham, MATLAB guide many like this book
2004 SPRING TERM (04-2)
January 5 Monday SPRING TERM CLASSES BEGIN
16 Friday SPRING TERM add/drop period ends
19 Monday Dr. Martin Luther King's birthday observance (University
closed)
January 26, MONDAY, EXAM1 -no make ups so be there!
February 18, WEDNESDAY, EXAM2- be there!
March 26, FRIDAY, EXAM3, no make ups!
March 5 Friday SPRING TERM DEADLINE for students to submit Monitored
Withdrawal forms to dean's office
March 7-14, incl. Sunday-Sunday Spring Recess for students (no
classes)
April 16 Friday SPRING TERM:
Last day for undergraduate day classes, Absolutely no late
homework
or projects accepted after this date!
April 19-24, incl. Monday-Saturday Final Exams
II. MATLAB RESOURCES
III. Repositories of Scientific Software
Before developing a program from scratch, you should first do a short
survey of available software for solving
the problem you're loking at.Two excellent places to search are:
http://math.nist.gov
http://www.netlib.org
Your project report should also have a short survey of other methods for solving your problem that you might find in one of these repositories!
IV. HOW TO RUN A FORTRAN PROGRAM
Here are some basic , basic instructions on how to
(a) write a fortran program [ie, create a file].
(b) how to run it.
(a) To create a file you need to use an editor. In unix, the pico
editor
is probably easiest because it's menu driven. Dont forget though that
unix
is case sensitive: large and small letters have different meanings
, so
get the capitalization exactly right!
At the prompt type:
pico progname.for
(the "progname " you may choose but be sure to make it
.for at the
end.)
Next paste in or type in
your program. Editing it is easy-read the
commands at
the bottom of the screen. When you are done type
'control'O
then type
'control'X
Now you've created a file progname.for.
(b) Here's how to run progname.for
At the prompt type
setup sunpro
At the next prompt type:
f77 -C progname.for
This compiles your program. Now run it by typing at the next
prompt
./ a.out
This tells the computer to dump your output to the screen.
Try writing a simple program to add 2 numbers and output it.
If it doesnt
work, check carefully the cases [small letters or caps] and the spaces
in
your commands.
Another comment: If you discover something interesting, email
me and I'll
send it to the whole class.
More Remarks:
These instructions are for our UNIXS system. There are a lot of free
FORTRAN compilers available [FORTRAN 77] as well as a lot of free C
compilers too. I'll email to you an addres on where to download one,
if
you are interested in working on a PC. I suggest though that you start
on
UNIXS if you've never programmed before.
Have fun!
V. FORTRAN Compilers-
Here are some FORTRAN resources including free and/or cheap FORTRAN compilers for a PC.
"The Fortran Library, http://www.fortranlib.com, is a comprehensive
guide
to online Fortran resources, including compiler vendors and
resellers, benchmarks, programming tools, books and articles on
Fortran
and numerical methods, and commerical and public domain Fortran
software.
The Fortran Market, http://www.fortran.com/fortran/ , also provides
many links to Fortran resources and is a reseller for several Fortran
90
and 95 compilers, benchmarking and test suites, and books on Fortran."
One former student installed one. Here below are his instruction on how to do this:
Subject: Fortran Compiler for PC's
First of all, the stuff has to be downloaded.
It can be gotten via anonymous ftp (using Netscape, for instance) from
ftp://ftp.bu.edu/pub/mirrors/simtelnet/gnu/djgpp/v2gnu/g770523b.zip
and you also need
ftp://ftp.bu.edu/pub/mirrors/simtelnet/gnu/djgpp/unzip386.exe
There are other things like additional documentation, but this provides
the
bare essentials (I realized that it needed to be cut down for people
to be
able to download it).
Then this file (g770523b.zip) needs to be unzipped. I recommend
making the
directory C:\DJGPP by typing
mkdir \DJGPP
at an MS-DOS prompt. Then, go to the directory where you
downloaded
g770523b.zip to, and type
move g770523b.zip \djgpp
move unzip386.exe \djgpp
cd \djgpp
unzip386 g770523.zip
You'll also need to make sure you can access the compiler, so add
C:\DJGPP\BIN to your PATH statement in your CONFIG.SYS. If you
don't know
how to do this, just type the following from an MS-DOS prompt.
echo PATH=%PATH%;C:\DJGPP\BIN >> \CONFIG.SYS
After that, you'll need to write the FORTRAN programs in something like
Notepad (do not use a Word Processor for this!). To compile your
program,
named (for instance) progname.for, type the following.
g77 -o progname progname.for
and to run the new program, type
progname
That should be it.
A Synopsis of "5-Statement FORTRAN"
ABSTRACT
1. Introduction.
FORTRAN is short for FORmula
TRANslation language. It is a low
2. FORTRAN Statements.
When you type a line of a
FORTRAN program, different locations of
Column
1
Column 2-5 Column
6
Column 7-72
Generally, try not to continue a statement from one line to another:
Keep
Types of Variables.
_ _ _ _ _ _ _ _ _ INTEGER COUNT
will make COUNT an integer even though the undeclared default of a
REAL NUMBERS:
_ _ _ _ _ _ _ REAL X
By default any variable beginning with
DOUBLE PRECISION
_ _ _ _ _ _ _ DOUBLE PRECISION X
They work like reals but carry more than 2x the number of significant
Arithmetic Operations.
CONTROL STATEMENTS
PRINT *, variables to be printed separated by commas.
Anything put in quotation marks is printed directly as written.
Examples
3. The Heart of the Program.
A computed basically can
only do 5 things:
Input data,
We've seen how to perform basic arithmetic calculations. Let's now
review
INPUT, OUTPUT and CONTROL
PRINT*, Next we print the value of X, X
This results in a printted line like:
Next we print the value of X .34567E2
when X has the value 34.567.
DECISIONS.
IF (condition is true) THEN
executable statement
For example, the following adds 1 to x if x = 0 and subtracts 1
otherwise:
The conditions are arithmetic inequalities using the following.
Math
FORTRAN
Example
LOOPS.
DO r I = beginning, end, stepsize
where "beginning", "end" and "stepsize" are all integers.For example,
this
PROGRAM SUM.for
Suppose we want to exit a
loop early when a condition holds. In
PROGRAM SUM.for
FORTRANs BUILT IN FUNCTIONS
FUNCTION STATEMENTS
Here is an example:
PROGRAM AREA.for
Note that 4.0*ATAN(1.0) is a standard way to code PI without typing
in all
PROGRAM AREA.for
Notes:
4. Arrays = Vectors and Matrices.
REAL X(50), A(50, 50)
which means the same as:
REAL X, A
For example, this computes the first 20 Fibonacci number:
PROGRAM Fibonacci.for
Remark: It's interesting to try running this changing "20" to, e.g.,
"50".
5. Programming "Rules of Thumb".
1. Be careful and correct: every hour you spend in checking,
planning
and
2. Use pseudo code to organize and plan your program.
3. Check it twice before running it! Then run it on several test
cases
4. Use modules. Break the program into clear chunks (one way is to
use
5. Use the right amount of generalization!
6. Print intermediate results.
7. Include warning messages.
8. Use variable names that are easy to understand and declare
all
9. Put lots of comments in!
10. Keep your loops simple!
11. Think a lot about your data structures.
12. Use arrays to store data.
13. Use built in functions and program libraries.
14. Put clarity (for people) above compactness or even speed of
execution
1. Consider the augmented matrix of a 3x3 linear system with entries:
0 2 1 4
a. Write out the system as equations for x_1, x_2 , x_3.
2.Consider the system in 3 significant digit arithmetic:
a. Solve it using GE with 3 digit arithmetic WITHOUT PIVOTING.
3. Consider the eqns:
a. Write this in matrix vector form. b. Write the systems
augmeted
matrix.
4. Give examples of 2 2x2 matrices that: a. Dont commute. b.
Commute.
5.Let A be the 3x3 matrix with rows:
a. Find det(A). b. Does A^(-1) exist? Explain! c. What does det(A) tell
about solving Ax=b? Explain!
Math 1080 NLA
1. a. What are the floating point operation counts for NxN systems for
the following: Gaussian elimination, Back substitution, Multiplying Ax,
solving Ax=b for tridiagonal A.
2. a.Find the LU decomposition of A ; multiply them to verify =LU,
where
A=
**********
Homework 4 due 2/11/2004 Math
1080
Consider the 2 point boundary value
Discretization of this leads to a tridiagonal system. Solution of the
system lead to an approximation to u(x) whose error is expected to be
O(h**2).
2. Next you need to thoroughly understand the program. Add VERY
EXTENSIVE
comment statements to the program and turn in a copy. Explain everything!
This includes:
3. Finally test tridiag.for or your own program as follows. Begin with
N=8 solve and compute error. Repeat with N=16,32,64,128,256,512...
VI. Acessing Matlab remotely.
Dr. M. Sussman has graciously
provided instructions for acessing Matlab remotely.
The first answer is: Yes, Matlab can be accessed remotely
"PittNet" -- is it a dialup connection (slow) or some
sort of fast connection? In either case, directions follow.
ASSUMING YOU ARE USING LINUX or another type of Unix:
Use ssh to get to unixs1 or unixs2, type "matlab": example
ssh youraccountname@unixs2.cis.pitt.edu
password
matlab
Wait a long while (1-2 minutes for a fast connection,
a looooong time for dialup) and Matlab will come up.
WARNING: if you have a (slow) dialup connection, you can
turn off the graphical stuff and run matlab in command mode:
(you get no graphics and no plotting)
ssh YoUrAcCoUnTnAmE@unixs2.cis.pitt.edu
password
DISPLAY=
matlab
If you have a dialup and you want plotting but no gui, do NOT
reset DISPLAY to nothing. Just do:
matlab -nosplash -nojvm
If you turn off the gui, you will need some sort of editor.
Either open another ssh session with your favorite editor
in it (pico, vi, emacs, etc.) or use the exclamation point
to start an editor from the Matlab command line (!pico ...)
ASSUMING YOU ARE USING WINDOWS
You either have an "X-server" program or you don't. I do
not know whether one is included in the programs they supply
to students.
ASSUMING YOU HAVE A DIALUP CONNECTION OR YOU DO NOT HAVE AN X-server
Use the Start->Run menu and type
telnet unixs2.cis.pitt.edu
(or unixs1 or unixs)
It will ask you to log in. Then just type
matlab
to get the LINE version of Matlab (no graphics, no plotting). There
is no way to do plotting without an X-server. You also will not have
the Matlab editor, but you can edit a file FROM THE MATLAB COMMAND
LINE with the command "!pico filename.m" where you don't type the
quotation marks and you put your own name where I have "filename.m".
When you exit pico, you will return to Matlab.
ASSUMING YOU HAVE BOTH AN X-server AND A FAST CONNECTION
Start the X-server first. You will need to know the "display" name
It will be something like 192.160.1.1:0 (your IP address first, then
colon zero).
Use the Start->Run menu and type
telnet unixs2.cis.pitt.edu
username, password, etc.
DISPLAY=192.160.1.1:0
EXPORT DISPLAY
matlab
There might be a telnet or rlogin or ssh command that comes with
the X-server. If so, the DISPLAY variable is automatically set.
REMARK:
There is a free Matlab clone called "octave" that runs on Windows
(If you run linux, install it from your CDs). See
http://octave.sourceforge.net/Octave_Windows.htm
It is not so pretty as Matlab, and it is mostly command-line
driven, but it will do plotting and most simple stuff.
VII. A Synopsis of FORTRAN.
W. Layton
Mathematics Department
University of Pittsburgh
This is prepared solely for the benefit of my students. Its intended
to have 2 purposes.
1. To introduce math students whove never programmed before but
are
used to the algorithmic
thought in rigorous proofs to a language quickly and get them working,
and
2. To do the same for students who have experience programming in
another
language like C, for example.
level language designed for doing scientific calculations and lots
of
them. Although it is out of favor in CS departments, it is extremely
handy
to know a bit of FORTRAN because:
(estimated) 95% of
scientific
software is in FORTRAN.
Thus, if you must modify an existing program it will likely be a
FORTRAN
one.
It is also useful for us because it is simple ( = easy to learn) and
its
logic parallels the logic of
mathematical
formulas. Generally, for
these and other reasons, if you program in another language, it is
a good
idea to know how to call a FORTRAN subroutine from that language.
characters (i.e., which column it is types in) have different
meanings.
Comment indicator Line number Blank or continuation
Executable
FORTRAN statement
formulas short enough that you can glance at it and see what it is
doing.
Thus, try to leave column 6 blank. A character in column 1 tells the
compiler to ignore the line so you use these lines to write notes to
yourself. You can also use "C " in column 1 to de-activate a line.
This is
called "commenting it out."
Variable names can have
no more than 7 characctters.
You should declare variables but in FORTRAN you don't need to
because there are defaults.
INTEGERS:
Integers are stored as such and added exactly. Any variable
beginning with
I, J, K, L, M, N
is by default an integer. Thus, old-style FORTRAN would use the
(undeclared) variable ICOUNT. Variables can also be declared
as integers
initially, meaning before the first executable statement. For example,
variable COUNT is real. In integer arithmetic
I =1/4
Returns I = 0 while in real arithmetic
X = 1.0/4.0
Returns X = 0.25. Don't use mixed mode arithmetic!
These can be declared as real before the first executable
statement by, e.g.,
A-H or O-Z
is also real. Reals are numbers with decimal digits such as
PI = 3.141592736
XINDEX = 1.0
They are stored in scientific notation and carry a certain number of
significant digits. Carrying 7 digits base 10 is typical although not
universal.
variables must always be declared n before the first
executable statement, e.g.,
figures as reals (also called single precision). Double precision is
the
normal mode for many scientific calculations. If you add a real to
a
double precision variable, you immediately lose al the extra accuracy
of
the double precision variable so:
Avoid mixed mode
arithmetic.
These are denoted by the
usual symbols
+, -, , / and *
Exponentiation is denoted by ** with differences between real and
integer
exponents:
(Integer) X**2 means X * X
(Real) X**2.0 means EXP(2.0 LOG( X ) ).
The arithmetic equals (=) has a different meaning than in arithmetic.
For
example, the statement
X=X+1.0
makes perfect sense in FORTRAN. It means, look at the left hand side,
find
the storage location set aside to store the variable called X and find
the
value of X. Add one to that value then put the result back in the X
storage location. This requires the computer to do something; hence,
it is
called an executable statement. (It's described informally by: "look
in
the box marked X. Get the number there; add one to it and put it back
in
the X box.")
Programs always end with
two statements that terminate the
program:
STOP
END
Another useful statement
is the unformatted print statement which
just dumps the output to your computer screen. This is fine for
moderate
amounts of output. (For lots of it, read about formatted print
statements
in a FORTRAN book.) An unformatted print takes the form
of this are given later. Generally, for moderate amounts of data, an
unformatted print is fine. On your terminal screen, highlight the
output.
Next copy and paste it into your favorite text editor and format it
and
then print it.
perform arithmetic calculations,
decisions based on logical or arithmetic tests,
output data and
loop (meaning perform al the above iteratively).
some of the remainder. The real power of the computer is unleashed
with
loops (doing a lot of calculations) and matrices and vectors (handling
a
lot of data).
Unformatted input is
(usually
from your terminal screen)
READ*, variables
While unformatted output is
PRINT*, variables.
You can label the variables by putting notes to be printed in quotes
as in:
Decisions in FORTRAN are
performed by "IF tests." There are many
kinds. One basic kind takes the form
ELSE executable statement
ENDIF
IF(X.GE.0) THEN X=X+1.0
ELSE X=X-1.0
ENDIF
<
.LT.
X<Y is written as: (X.LT.Y)
>
.GT.
X>Y is written as: (X.GT.Y)
=
.EQ.
I=J is written as: (I.EQ.J)
> or
=
.GE.
is written as: (X.GE.Y)
< or
=
.LE.
is written as: (X.LE.Y)
not equal
.NE.
is written as: (I.NE.J)
These are "DO-Loops" in
FORTRAN and "FOR-Loops" in C. If r is a
statement number, they take the form
executable statements
r
CONTINUE
computes the sum
1+1/2+1/4+1/8++ 1/(2**1000).
SUM=0.0
DO 10 I=0,1000,1
ADDEND=1.0/(2.0**I)
SUM=SUM+ADDEND
10 CONTINUE
STOP
END
this case, in FORTRAN the only way is to use a "GO TO" statement.
(This
is
the only valid use of GO TO's.) For example, to exit the above when
SUM>
1.5 we add an if-test with a GO TO:
SUM=0.0
DO 10 I=0,1000,1
ADDEND=1.0/(2.0**I)
SUM=SUM+ADDEND
IF(SUM.GT.1.5)
THEN GO TO 20
ENDIF
10 CONTINUE
20 PRINT*, "I=",I, "and sum=", SUM
STOP
END
There are many built in
functions in FORTRAN. If you put a "D" in
front the function returns a double precision answer. Some common ones
include:
ABS(X)=|x| ,
TAN(X) = tangent(x),
ATAN(X)= arctangent(x),
COS(X), SIN(X),TAN(X),... ,
EXP(X) = exponential function of x= e**x ,
LOG(X)= natural logarithm of x,
LOG10(X)= logarithm base 10 of x,
SQRT(X)=square root of x,
FLOAT(I) and REAL(I) convert integer I into a real to avoid mixed mode
arithmetic,
DFLOAT(I) makes I a double precision real,
and so on!
Function statements are
very handy to code a simple formula.
IMPORTANT: MUST BE BEFORE THE FIRST EXECUTABLE STATEMENT!
AREA( R)=4.0*ATAN(1.0)*R**2
X=2.0
A=AREA(X)
PRINT*, "Radius=", X,
"AREA="
, A
STOP
END
its digits!
If a function uses more
calculations or a longer formula then use
a function subroutine. Function subroutines are very useful!!! Here's
an
example:
PI=4.0*ATAN(1.0)
R=2.0
A=AREA(R,PI)
STOP
END
FUNCTION
AREA(X,Y)
AREA=Y*X**2
RETURN
END
You must have "AREA = " somewhere in function subroutine AREA
And you must always have "RETURN, END" at the end.
Vectors and matrices are
the way to store and manipulate lots of
data. They must be set up with various dimensioning statements
BEFORE THE FIRST EXECUTABLE STATEMENT!!!
Examples of these
dimensioning
statements are the following:
INTEGER INDEX(50)
INTEGER INDEX
DIMENSION X(50), A(50, 50), INDEX(50)
REAL FIBO(20)
FIBO(1)=1.0
FIBO(2)=2.0
DO 10 I=3,20,1
FIBO(I)=FIBO(I-1)+FIBO(I-2)
10 CONTINUE
PRINT*,FIBO(20)
STOP
END
You will soon see why FIBO(.) is stored as a real number rather than
(at
first and second consideration) the more natural integer.
These days one is more
often
modifying an existing code or linking
pieces of codes than programming a new application from scratch.
Nevertheless, the following "rules of thumb" will, if followed, save
you
hours of headaches in debugging:
double checking will save four hours of debugging.
with known true-solutions.
FUNCTION subroutines). Check and debug each module independently
of the
whole program before testing the whole program.
variables.
VIII. Some of Our Assigned Homeworks.
Math 1080 Numerical Linear
Algebra
2 1 0 0
1 1 1 1
b.Solve using Gaussian elimination WITH PARTIAL PIVOTING
[NO CREDIT if algorithm is not followed EXACTLY!]
0.000100 X_1 + 1.00 x_2 = 1.00
1.00 x_1 + 1.00 x_2 = 2.00
b. Repeat with partial pivoting. c. Draw conclusions.
u_1 - u_2 + 2 u_3 =4
u_2 -2 u_3 + u_5 =2
-u_1 + 2 u_2 - u_5 = -1
u_1 + 2 u_2 + 3 u_3 + 4 u_4 + 5 u_5 = 6
1 2 3
4 5 6
6 9 12
HW 3 Due Wednesday 2/4/2004
(b) If a program takes 10 minutes to perform each of the above and
you double N, about how long will it take?
4 3
2 1
b.Using LU, solve Ax = (0,1)^tr
3. For solving Ax_j = b_j, j=1,...,M, (M fairly large), What are the
advantages of using the LU decomposition as a solver over just using
Gaussian
elimination M times?
Numerical Linear Algebra
-u'' = f(x) , for 0<x<1, u(0)=0, u(1)=0.
Your HW is to test this expectation experimentally.
1. Consider the program tridiag.for which computes the above
approximation.
First , run the program, exactly as it stands. Copy->paste >print the
session
so turn in as part of the HW.
What is the problem?What is the true solution,the mesh-width, what
does each variable mean, what does each loop calculate, how is the error
calculated, does the program correspond to the notes tridiagonal GS
algorithm,
what is different, how does it affect the solution.
Add all this in using comment statements.
YOU MAY DO THIS IN TRIDIAG.FOR OR IN YOUR OWN , SELF-WRITTEN PROGRAM
FOR THE HW.
This involves editing the file and changing : N=8
to:
N=16 , for example.
(a) Assuming: error(h) = C h**a
you can solve for the exponent a as follows:
e(h)/e(h/2) = C h**a /
C(h/2)**a
= 2**a
Take logs of both sides and solve for a.
(b)Plot e(h) vs h. Check graphically if a is roughly 2
( c ) Keep decreasing h until you see the rate of convergence degrade
to some a<2. This is the point where roundoff error influences the
solution
accuracy. Do you run out of storage in your account first?
Due MONDAY 3/1/2004
This HW is to study how large a discrete Laplacian matrix you can
store on
whatever computer you plan to use in 1d, 2d and 3d.
I will email you a FORTRAN program. This program will load the
linear
system arising from the discrete Laplacian on the unit square I.e. In
2
DIMENSIONS. It stores it as a full matrix.
1. READ the program (save it to a file, load2004.for, exit pine, then
type
pico load2004.for
at the unixs prompt.)
Your task for part (a) is to understand the program by
either: I.
Edit out all my comments and then add your own explaining it dont
just
retype mine) and turn in a hard-copy of the result, or ii. Write an
equivalent program yourself, with comments, in another language. Turn
in a
hard-copy.
You do not have to use FORTRAN but even if you don't you can learn a
lot about FORTRAN by just reading it and adding remarks. You can get
extra
credit by writing your own program in another language.If you want to
just
run the program on UNIXS you need to save it to a file. Read the
instructions on my web page!
2. Your next job is to start small and keep increasing N and the
dimension statements until you get an error message telling you that
youre out of space!
REMARKS: USE UNIXS!! WHEN YOU GET THE ERROR MESSAGE remove the
core file
by typing at the unixs prompt:
rm core
Interpret your results by answering the following:
Next, take that information and find:
The smallest H or N for which you can store it as a banded matrix
in
1d.
Explain how you got that number!
The smallest H or N for which you can store it as a banded matrix
in
2d.
Explain how you got that number!
The smallest H or N for which you can store it as a banded matrix
in
3d.
Explain how you got that number!
The smallest H or N for which you can store it as a full matrix in
2d.
Explain how you got that number!
3. Make a chart of your findings and draw conclusions.
***********
Homework 6,
Math 1080 NLA 2004,
Due: March 19, 2004
1. To solve the model Poisson problem with h=1/N+1
a. Fill in the chart below for d=1,2,3
d= *** #Degrees of freedom *** Bandwidth *** Band Storage
***
Band
G.E.
FLOPS
___________________________________________________
d=1
___________________________________________________
d=2
___________________________________________________
d=3
___________________________________________________
b. If the smallest mesh solvable as above in 2d is h=1/101, predict the
smallest mesh attainable in 3d.
2. Consider the Model Poisson problem in 2d with h=1/2, f(x,y)=-(x+y), and
g(x,y)={0 if x=0 or if y=0, and 1 if x=1 or if y=1}
Compute by hand an approxmation to u(1/2, 1/2).
3. If A is symmetric, and lamda=lamda(A)
a. Show cond_2(A) = | lamda |_max / | lamda |_min
b. Show that cond_2(A^2) = [ cond_2(A) ]^2
4. Take the same f and g of problem 2. Take h=1/3.
a. Find, by hand, the linear system.
b. By hand, do two steps of the Jacobi method for this linear system.
5. a. State the spectral mapping theorem
b. Let f(z)=1/(3-2z). What does f(A) mean for a square matrix A?
c. Find lamda(f(A)) if A_2x2 =
1 30
0 -10