MATH 4650-001 & SC 4656-001: Numerical Analysis I
Computer Project 1.
Convergence of the secant method movie.
Fall 2002, University of Colorado Denver
IMPORTANT ANNOUNCEMETS:
The due date for the project report is November 4, 2002.
INSTRUCTOR:
Prof. Andrew Knyazev
Office: CU (Dravo Bldg) 644. Phone: (303) 556-8102.
Office hours: Tuesday 4-5 pm, or by appointment.
WWW: http://math.ucdenver.edu/~aknyazev
TEXTBOOK:
Numerical Mathematics and Computing, 4th Edition
by Ward Cheney and
David Kincaid.
Published by Brooks/Cole Publishing Company
Fourth Edition, 1999
ISBN 0-534-35184-0.
560 pages
ASSIGNED COMPUTER PROJECTS:
A project consists of software development, testing and analysis.
There will be two projects, each is worth 20% of the final grade.
Both projects are individual, no group projects will be allowed.
COMPUTING:
Individual projects will be accepted in one of the following languages:
Matlab, C, C++, Fortran and Java.
My recommendation is to use MATLAB, since it can link executable files,
it has graphics already built in and
it is an interpretive language originally
developed to handle mathematical problems.
The best place to work on the project is
the MERC lab.
Please register for Math 1999 lab to reserve a computer.
Each student will have an account on math (the name of the computer),
and other (except for beowulf) Linux-based networked computers
of the CCM graduate lab soon after the census date.
Our first project requires high-end graphics tools, which are
easily available in Matlab, but might not be simple in
other computer languages. Please use Matlab unless you
are an expert in programming and know what you are doing.
I would only be able to provide help with Matlab for the project.
THE PROJECT DESCRIPTION:
-
SOFTWARE DEVELOPMENT:
-
Write a code of the Secant Method, Section 3.3.
Please use the algorithm presented in the book on p. 124.
Here is an example of a Matlab secant.m function input
and output, which is recommended to use. Here is another example,
a Matlab code for bisection.
Make sure that your code outputs, in addition to
the output of the algorithm on p. 124, the sequence of approximations to the
zero and the sequence of the corresponding function values as in the
examples above.
-
Before you run the code, you need to create a file f.m, which
describes the function, and put it in the same directory.
For a sample file
click here.
Finally you can run it like in the following
example: run_me.m.
Note: if you are doing it on math, use the command
cp /home/faculty/aknyazev/public_html/teaching/02/4650/p1/* .
to copy all files you need into the current directory.
- The second part of the main function
run_me.m calls
a function
get_convergence_movie.m
which generates the movie
movie.avi.
When you are done with writing, debugging and testing
your new code secant.m, you should use
run_me.m and
get_convergence_movie.m
to generate your own movies for different functions and
initial points.
- TESTING
- First of all, you should test your code
for the example provided in the textbook on p. 125.
Make sure your code is getting the same approximations
as given in the texbook on p. 125. Explain, why
your numbers are close, but not exactly the same
as in the example.
- Test you code for different functions and
initial approximations, suggested in Computer
Problems 3.3 section of the text on pp. 131-132.
- Compare your numerical results with those
obtained by the
Secant Method LIVE for several examples.
- ANALYSIS
- Find an example when the secant method
fails to produce an approximation because of
division by zero and illustrate the failure
by running your code for this example.
- Try to find an example when the secant method
does not converge in 100 iterations.
(Hint: perturb the initial points that have led
to division by zero in the previous question).
- Set a small secant_tolerance=1e-14;
and run the code
[r,sequence_x,sequence_fx]=secant('f',x_0,x_1,n_max,secant_tolerance);
for several different function, when it converges. For each run
draw the picture of the convergence history using
close all
semilogy(abs(sequence_x-r))
print -dpng slope.png
(the last command creates a picture file slope.png in your
working directory, which you may want to include
in your project report)
and conclude (from the way the picture looks) if you
have a linear or superlinear convergence for these cases.
(Hints: How should a history of the errors look like
in semilogy scale when the convergence is linear?
Draw a similar picture for the bisection, using the code provided.)
- THE PROJECT REPORT
- The report should be done electronically
on a Web page created specifically for the project.
Feel free to use your account on math.ucdenver.edu
for the Web page.
- The project report should have links to
all function written for the project and to
all movies generated.
- The report needs to include a detailed
description of the testing procedures and results,
including complete descriptions of the movies generated.
- The report must include the results of the analysis.
- On the due day, please email me the link to your
main Web page or directory with the project report and do not
change it after that.
Sample student reports by
Dmitriy Tserekhman,
Mike Lewis,
and Jason Gurgel.
INTERNET RESOURCES:
- MATLAB:
- My previous similar projects in NA II: