load lecture9 x=1 x = 1 iMax iMax = 40 test6 expx = 2.7183 exact = 2.7183 error = 0 test7 expx = 0 exact = 2.7183 error = -2.7183 test7 expx = 2.7183 exact = 2.7183 error = 0 if 1 > 2 disp('The class is wrong.') end if 2>1 disp('The class is right') end The class is right test9 The class is right % > greater % < less % >= greater or equal % <= less or equal % == equal % ~= not equal test10 pi/2 is bigger test11 pi/2 is between 1 and 2 and not 1.5 test11 halfpi = 2 test11 halfpi = 2 pi/2 is between 1 and 2 and not 1.5 % && logical and % || logical or % ~ logical not test11 halfpi = 1.5708 pi/2 is between 1 and 2 and not 1.5 test11 pi/2 is between 1 and 2 and not 1.5 A=[1 2 3; 0 5 6; 7 8 9] A = 1 2 3 0 5 6 7 8 9 b=[3;2;9] b = 3 2 9 test12 condA = 37.9389 relErrorMatlab = 8.4241e-15 x = 1 -2 2 A(2,1)=4 A = 1 2 3 4 5 6 7 8 9 test12 condA = 5.0523e+16 relErrorMatlab = 11.2183 There is no reasonable solution to this system test13 tol = 1.0000e-04 iMax = 100000 total = 1.6350 exact = 1.6449 estError = 1.0000e-04 trueError = 0.0100 test13 tol = 1.0000e-04 iMax = 100000 total = 1.6448 exact = 1.6449 estError = 1.0000e-04 trueError = 9.9995e-05 test13 tol = 1.0000e-04 iMax = 100000 total = 1.6448 exact = 1.6449 estError = 1.0000e-04 trueError = 9.9995e-05 test13 tol = 1.0000e-04 iMax = 100000 total = 1.6448 exact = 1.6449 estError = 1.0000e-04 trueError = 9.9995e-05 test13a tol = 1.0000e-04 iMax = 100000 total = 9.7876 estError = 1.0000e-04 test13a tol = 1.0000e-04 iMax = 100000 total = 12.0901 estError = 1 i i = 100000 x=1 x = 1 test14 expx = 2.7183 exact = 2.7183 error = 0 i = 18 A A = 1 2 3 4 5 6 7 8 9 test12 condA = 5.0523e+16 relErrorMatlab = 11.2183 There is no reasonable solution to this system A(2,1)=0 A = 1 2 3 0 5 6 7 8 9 test12 condA = 37.9389 relErrorMatlab = 8.4241e-15 x = 1 -2 2 A(2,1)=1.e-14 A = 1.0000 2.0000 3.0000 0.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test12 condA = 37.9389 relErrorMatlab = 8.4241e-15 x = 1.0000 -2.0000 2.0000 A(2,1)=1.e-12 A = 1.0000 2.0000 3.0000 0.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test12 condA = 37.9389 relErrorMatlab = 8.4241e-15 x = 1.0000 -2.0000 2.0000 A(2,1)=4+1.e-13 A = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test12 condA = 4.9436e+14 relErrorMatlab = 0.1098 There is no reasonable solution to this system A(2,1)=4+1.e-11 A = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test12 condA = 5.0529e+12 relErrorMatlab = 0.0011 x = 1.0e+11 * -4.0002 8.0004 -4.0002 Warning: estimated error is 1.1E-01%