A brief introduction to MATLAB is presented. The material is based primarily from the MATLAB tutorial and the help files.
A convention we propose for naming MATLAB files and variables.
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.
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.
An application for solving linear systems: Computing Google's PageRank.
Information on the handling of sparse matrices.
Notes on the Sherman-Morrison Formula
Script to test Back-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 (from Moler)
An application for solving linear least squares systems: Vector Space Model for Information Retrieval.
An article for further reading on: Vector Space Model for Information Retrieval.
Analyze Motion under gravity using normal equation
Analyze peak height of hills using normal equation
Study the condition-squaring effect
Testing Householder QR decomposition
Example 3.21 - Total least squares
Studying the orbit of a planet
Function to plot part of an elliptical orbit
An image file that is read by the above program.
Function or Fixed-Point Iteration
Bisection Method (hardwired function)
Bisection Method (inline function)
Bisection Method (implemented as a function)
Newton's Method (comparing the case of simple and double roots)
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
Halley's method is a generalization of Newton's Method with higher convergence rates.
The Global Positioning System is used as an example to illustrate root finding for a system of nonlinear equations.
Interpolation using Monomial Basis Functions
Divided Difference (a better implementation)
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
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
Divided Differences method to construct Newton's interpolant.
Rational Function interpolation.
Interpolation using the cubic spline.
Interpolation using parametric cubic spline.
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 to accelerate the computation of Pi according to Archemedes
Script to test Romberg quadrature
A problematic function used to test various quadrature rules
A function used to test various quadrature rules
Here is a copy of the midterm exam.
Here are some real life examples
of what can happen when numerical algorithms are not correctly applied.