A brief introduction to MATLAB is presented. The material is based primarily from the MATLAB tutorial and the help files.
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.
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
A function used by LU_rowPivot.m to swap rows. It is actually faster and uses less memory to use indexing in MATLAB.
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
Halley's method is a generalization of Newton's Method with higher convergence rates.