% Relational operators % > greater % >= greater or equal % < less % <= less or equal % == equal % ~= not equal test8 pi/2 is greater than sqrt(2) Good that that is settled % Logical operator % ~ logical NOT % && logical AND: CONDITION1 && CONDITION2 % ~ logical NOT: NOT CONDITION % && logical AND: CONDITION1 && CONDITION2 % || logical OR: CONDITION1 || CONDITION2 % XOR: either condition true exist('test8.m')&&test8 {Attempt to execute SCRIPT test8 as a function: \\print2.eng.fsu.edu\dommelen\My Documents\MATLAB\METLAB\test8.m} a=0 a = 0 if (a ~= 0) && (1/a > 2) 1/a end if (a ~= 0) & (1/a > 2) 1/a end if (a ~= 0) & (1/a > 2) test9 pi is between 3 and 4 and not 3.2 test9 pi is between 3 and 4 and not 3.2 test9 % ~ has priority over the relational operators test9 pi is between 3 and 4 and not 3.2 test9 pi is between 3 and 4 and not 3.2 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 test10 {Error: File: test10.m Line: 9 Column: 40 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.} test10\ test10\  {Error: Invalid expression. Check for missing or extra characters. } test10 condA = 37.9389 xRellerrDueToMatlab = 8.4241e-15 {Error using \ Matrix dimensions must agree. Error in test10 (line 6) x=A\b} b=[3 2 9]' b = 3 2 9 test10 condA = 37.9389 xRellerrDueToMatlab = 8.4241e-15 x = 1.0000 -2.0000 2.0000 A(2,1)=4 A = 1 2 3 4 5 6 7 8 9 test10 condA = 5.0523e+16 xRellerrDueToMatlab = 11.2183 *** Error: There is no reasonable solution A(2,1)=4+10*eps A = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test10 condA = 1.7104e+16 xRellerrDueToMatlab = 3.7979 *** Error: There is no reasonable solution A(2,1)=4+100*eps A = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 test10 condA = 2.0347e+15 xRellerrDueToMatlab = 0.4518 x = 1.0e+14 * -1.7899 3.5799 -1.7899 *** estmated error 45.2% test10 condA = 2.0347e+15 xRellerrDueToMatlab = 0.4518 x = 1.0e+14 * -1.7899 3.5799 -1.7899 *** estmated error 45.2% tol=0.0001 tol = 1.0000e-04 pi^2/6 ans = 1.6449 test11 total = 1.6350 totalExact = 1.6449 test11 total = 1.6448 totalExact = 1.6449 tol=0.001 tol = 1.0000e-03 test11 total = 1.6439 totalExact = 1.6449 test12 {'test12' is not found in the current folder or on the MATLAB path, but exists in: \\print2.eng.fsu.edu\dommelen\My Documents\MATLAB\METLAB Change the MATLAB current folder or add its folder to the MATLAB path.} test11 total = 1.6439 totalExact = 1.6449 test12 n = 0 {Undefined function or variable 'nMax'. Error in test12 (line 4) for n=1:nMax} test12 n = 0 total = 1.0e+14 * -1.7899 3.5799 -1.7899 totalExact = 0 Inf 0 x=1 x = 1 test12 n = 0 total = 2 totalExact = 2.7183 test12 n = 0 total = 2.7183 totalExact = 2.7183 tol tol = 1.0000e-03 test12 n = 0 totalOld = 1 totalOld = 2 totalOld = 2.5000 totalOld = 2.6667 totalOld = 2.7083 totalOld = 2.7167 totalOld = 2.7181 totalOld = 2.7183 totalOld = 2.7183 totalOld = 2.7183 total = 2.7183 totalExact = 2.7183 format long test12 n = 0 totalOld = 1 totalOld = 2 totalOld = 2.500000000000000 totalOld = 2.666666666666667 totalOld = 2.708333333333333 totalOld = 2.716666666666666 totalOld = 2.718055555555555 totalOld = 2.718253968253968 totalOld = 2.718278769841270 totalOld = 2.718281525573192 total = 2.718281801146385 totalExact = 2.718281828459046