‐ Code here is in two parts. Written as a for/do loop and also “calculator” style. The loop method is certainly more efficient coding style. Homework can be done either way. The scilab code is exactly the same as what one would type in matlab or octave. ‐>A=[1 A = 1. 4. 1. 1. ‐‐>for ans = 4. ans = 6. ans = 8. ans = 10. ans = 12. ‐‐>A(1 ans = 4. ‐‐>A(1 ans = 6. ‐‐>A(1 ans = 8. ‐‐>A(1 ans = 10. ‐‐>A(1 ans = 12. ‐‐>A(1 ans = 2. ‐‐>A(1 ans = 2. ‐‐>A(1 ans = 2. ‐‐>A(1 ans = 2. ‐‐>A(1 ans = 2. 1 1 1 1; 4 3 2 1; 1 1. 1. 1. 3. 2. 1. 2. 2. 1. 3. 2. 2. j=1:5, A(1,1)== 2. = 2. = 2. = 2. = 2. 1,1)=1;det(A) = 1,1)=2;det(A) = 1,1)=3;det(A) = 1,1)=4;det(A) = 1,1)=5;det(A) = 1,1)=1; B=inv(A)*= 1,1)=2; B=inv(A)*= 1,1)=3; B=inv(A)*= 1,1)=4; B=inv(A)*= 1,1)=5; B=inv(A)*= 1 2 2 1; 1 3 2 2] =j; B=det(A)* *det(A);B(1,1) *det(A);B(1,1) *det(A);B(1,1) *det(A);B(1,1) *det(A);B(1,1) inv(A);[det(A) B B(1,1)], end Mathematica Note that matrix( c(1,1,1,1,4,3,2,1,1,2,2,1,1,3,2,1),4,4, byrow=TRUE) gives the matrix “transposed” as in the other languages
View Full Document