Question
Problem 2. In this problem we consider the question of whether a small value of the residual kAz bk means that z is a good
Problem 2. In this problem we consider the question of whether a small value of the residual kAz bk means that z is a good approximation to the solution x of the linear system Ax = b. We showed in class that, kx zk kxk kAkkA 1 k kAz bk kbk . which implies that if the condition number kAkkA1k of A is small, a small relative residual implies a small relative error in the solution. We now show computationally what can happen if the condition number is large. A standard example of a matrix that is ill-conditioned is the Hilbert matrix H, with entries (Hij ) = 1/(i+j1). For n = 8, 12, 16 (where H is of dimension nn), use Matlab to solve the linear system of equations Hx = b, where b is the vector Hy and y is the vector with yi = 1/ n, i = 1 . . . n. Clearly, the true solution is given by x = y, and we let z denote the approximation obtained by Matlab. Then calculate for each value of n the following quantities: (i) the relative error kx zk/kxk, (ii) the relative residual kHz bk2/kbk, (iii) the condition number kHkkH1k, and (iv) the product of the quantities in (ii) and (iii). Arrange all these numbers in a table. The Matlab commands 1 norm and cond can be used to compute the norm and condition numbers, respectively. When vectors are input, Matlab writes them as row vectors. To convert y to a column vector, write it as y 0 . To solve the linear system Hz = b in Matlab, type z = H \ b. An example of a Matlab loop is given below; the semicolon keeps Matlab from writing unwanted output to the screen. To avoid potential problems, type clear before running a new value of n. Example of a Matlab Loop: for i=1:10 y(i) = 1/sqrt(10); end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started