Instructional materials - Spring 2004


Lecture notes from Prof. Michael T. Heath

 


Chapter 0.

A Brief Introduction to MATLAB

A brief introduction to MATLAB is presented. The material is based primarily from the MATLAB tutorial and the help files.


Chapter 1.

Lecture material:

Brief introduction to the representation and storage of integers on a digital computer.

Plotting of a seemingly simple function can sometimes give unexpected wacky results that are due to the finiteness of the underlying floating-point system.

A closer look at floating-point systems.

A forward difference approximation for the first derivative.

Detailed explanation of the above wacky plot.

We illustrate how cancellation error can limit the accuracy that can be achieved by an algorithm for computing pi, and how that error can be avoided. The algorithm was used by Archimedes over 2,000 years ago.

Algorithms for computing pi.

Some MATLAB programs:

A plot of a seemingly simple function reveals some wacky results.

A scalar version of the same program.

A plot reproducing the features seen in the wacky plot.

A program to study the forward difference approximation for the first derivative. We examine the trade-offs between truncation and rounding errors.

The following programs are written for Assignment 1 (Exercise 1.9). Only the last one is required the problem.
(1) a function that simulates the rounding of decimal digit to any specified precision, p, - Rounding to decimal precision p.
(2) a script file using the above function for parts (a)-(c) of the problem. - script to run parts (a)-(c).
(3) a script file for part (f) of the problem - script to run part (f).

Version 1, Version 2, Version 2 of the programs for the Archimedes problem.

Ramanujan's series for pi: Version 1 and Version 2.

Chudnovsky brothers series for pi.

Salamin and Brent iteration for pi.


Chapter 2.

MATLAB programs:

Back-substitution

Script to test Back-substitution

Forward-substitution

Script to test two different implementations of Forward-substitution

Forward-substitution using column processing

Forward-substitution using row processing

LU Factorization using Gauss Elimination without Pivoting

Script to test LU Factorization using Gauss Elimination without Pivoting

LU Factorization using Gauss Elimination with Partial Pivoting

Script to test LU_pivot.m

A function used by LU_rowPivot.m to swap rows. It is actually faster and uses less memory to use indexing in MATLAB.

Rank-one Updating

Notes on the Sherman-Morrison Formula

A More Direct Derivation


Chapter 5.

MATLAB programs:

Function or Fixed-Point Iteration

Bisection Method (hardwired function)

Bisection Method (inline function)

Bisection Method (implemented as a function)

Newton's Method

Newton's Method (comparing the case of simple and double roots)

Halley's Method

Secant Method

Inverse Interpolation

Linear Fractional Interpolation

Multi-Dimensional Newton's Method

Function used in example 5.15 for the Multi-Dimensional Newton's Method

Function for the Jacobian matrix in example 5.15 for the Multi-Dimensional Newton's Method

Broyden's Method

 

Notes on Halley's Method

Halley's method is a generalization of Newton's Method with higher convergence rates.


Chapter 7.

MATLAB programs:

Monomial Basis Functions

Interpolation using Monomial Basis Functions

Lagrange Basis Functions

Divided Differences

Divided Difference (a better implementation)

Newton's Interpolation

Horner's Method for evaluating polynomials

A dumb way to evaluate polynomials

An even dumber way to evaluate polynomials

Horner's Method for evaluating polynomials with a shift

Problem interpolating a noisy straight line using polynomials

Problem with interpolation using a single polynomial of high degree

Interpolation using Rational Function

Interpolation using Rational Function (improved implementation)

Testing Rational Function interpolation

Natural Cubic Spline

Matlab Function for Natural Cubic Spline

Another example of the Natural Cubic Spline

An example using Parametric Cubic Spline

A second example using Parametric Natural Cubic Spline

A third example using Parametric Cubic Spline

Notes on Divided Differences

Divided Differences method to construct Newton's interpolant.

Notes on Rational Function Interpolation

Rational Function interpolation.

Notes on Cubic Spline

Interpolation using the cubic spline.

Notes on Parametric Cubic Spline

Interpolation using parametric cubic spline.


Chapter 8.

MATLAB programs:

Midpoint Quadrature Rule

Trapezoid Quadrature Rule

Simpson's Quadrature Rule

Script to test various quadrature rules

8-Point Gauss-Legendre Quadrature

24-Point Gauss-Legendre Quadrature

48-Point Gauss-Legendre Quadrature

Adaptive quadrature based on Simpson's rule

Adaptive quadrature based on the Gauss-Legendre Quadrature rule

Forward Difference Formula for the first derivative

Richardson Extrapolation

Richardson Extrapolation to accelerate the computation of Pi according to Archemedes

Romberg Quadrature

Script to test Romberg quadrature

A problematic function used to test various quadrature rules

A function used to test various quadrature rules


Chapter 3.

MATLAB programs:

Analyze Motion under gravity using normal equation

Analyze peak height of hills using normal equation

Fitting a noisy straight line

Study the condition-squaring effect

Householder QR decomposition

Testing Householder QR decomposition

Example 3.17

Example 3.18

Example 3.20

Example 3.21 - Total least squares

A rank deficient matrix

Example 3.14 - using svd

Studying the orbit of a planet

Function to plot part of an elliptical orbit

Image compression using svd

An image file that is read by the above program.