The answer computer gives you is almost always approximate.
All the numbers are represented as:
where is base, is precision, is integer between 0 and and is integer between and .
Matlab basics were presented.
Machine precision . Relative error for presenting normalized number is given by
We had a review of Chapters 1 and 2, and we covered LU decomposition with examples.
N=12; LogTimesInversion=[1:N];LogTimesLU=[1:N]; for k=[1:N] n = 2^k;A=rand(n,n);b=rand(n,1); tic;B=inv(A); LogTimesInversion(k)=log(toc); tic; x = A\b;LogTimesLU(k)=log(toc); end plot([1:N],LogTimesInversion,'ro',[1:N],LogTimesLU,'bo',[1:N],LogTimesInversion,[1:N],LogTimesLU)
Vector and Matrix 1-norm, 2-norm and infinity-norm.