Lab 4
We will consider forward substitution and an iteration scheme for linear systems.
Contents
Exercise 1: Forward substitution
Let be an lower triangular matrix with non-zero diagonal entries. We want to solve
More explicitly:
This gives the set of equations
And in general
Given an augmented matrix, implement the forward substitution algorithm to solve , call your function
Forsub()
Test your algorithm on a matrix given by
n = 10; L = rand(n); b = rand(n,1); for i = 1:n for j = i+1:n L(i,j) = 0; end end
Exercise 2: An iterative solution
Define matrix for any dimension by
Define to be the lower-triangular part of , and . If you want to solve you can consider , . The solution is a fixed point of .
Use your forward substitution algorithm (and not compute the inverse of L!) and fixed-point iteration to solve for when is a vector of all ones. Examine the convergence of the method using
max(abs(x-y))
which returns the maximum entry (in absolute value) of the difference .