(a) with condition number 6.17 in norm 2
(b) with condition number 10.98 in norm 2
(c) with condition number 6.98 in norm 2
(d) with condition number 2 in norm 2
(a)
(b) To solve , write , so that . Solve by backward , solve by forward
(c)
I do not see obvious connection
(d)
The reason we prefer LU to UL is purely conventional, there is no mathematical reason beyound this choice.
(a) Assume we have a matrix
We get
Then the condition number of a matrix is
for
and
for .
Then we conclude that the matrix is ill conditioned for very large and very small values of .
(b) If the residual is small, but nonzero, the error will be small for small condition number. If condition number is large, the error will be large. So if we take , the error will be large even for a small residual.
Use and , where is a numerical solution, to show that . So we have and
(c) Using we get , so for large the residual is going to be very large with small error.
ValuesOfn=[4,8,12,16] for k=1:length(ValuesOfn) n = ValuesOfn(k);P = pascal(n); P(n,1)=0;xTheory=ones(n,1);b=P*xTheory; xInv=inv(P)*b;xLU=P\b; fprintf("====================================\n"); fprintf("n=%d\n",n); fprintf("Inversion Relative Error=%e;LU relative error=%e\n",norm(xInv-xTheory)/norm(xTheory),norm(xLU-xTheory)/norm(xTheory)); fprintf("Inversion Residual Norm =%e; LU Residual norm=%e\n",norm(P*xInv-b),norm(P*xLU-b)); end
We see from this output that the LU inversion is more numerically accurate for larger matrices.
We also see that the value of the residual is not an indication of an accurate solution.
The vector function is given by
The Jacobian is equal to
Running the Newton code returns for the positive solutions