5f892713c3 2021-03-03 1: %%%%%%%%%%%%%%%%%%%%%
5f892713c3 2021-03-03 2: % LINEAR ALGEBRA
5f892713c3 2021-03-03 3: %%%%%%%%%%%%%%%%%%%%%
5f892713c3 2021-03-03 4:
5f892713c3 2021-03-03 5: % Enable fancy output for easier viewing of
5f892713c3 2021-03-03 6: % matrix output
5f892713c3 2021-03-03 7: fancy_output$
5f892713c3 2021-03-03 8:
5f892713c3 2021-03-03 9: % Load linear algebra package
5f892713c3 2021-03-03 10: load_package linalg$
5f892713c3 2021-03-03 11:
5f892713c3 2021-03-03 12: % Define a complex 3x3 matrix
5f892713c3 2021-03-03 13: m1 := mat((1+i*3, 2-i*5, 7-i), (4-i*2, 6+i*9,-8+i*4), (-3-i*7, 3+i*2, -1+i*6));
5f892713c3 2021-03-03 14:
5f892713c3 2021-03-03 15: % Determinant of matrix
5f892713c3 2021-03-03 16: write "|m1| = ", det(m1)$
5f892713c3 2021-03-03 17:
5f892713c3 2021-03-03 18: % Trace of matrix
5f892713c3 2021-03-03 19: write "trace(m1) = ", trace(m1)$
5f892713c3 2021-03-03 20:
5f892713c3 2021-03-03 21: % Characteristic polynomial
5f892713c3 2021-03-03 22: write "characteristic polynomial of m1:";
5f892713c3 2021-03-03 23: char_poly(m1,eta);
5f892713c3 2021-03-03 24:
5f892713c3 2021-03-03 25: % Enable real arithmetic
5f892713c3 2021-03-03 26: on rounded$
5f892713c3 2021-03-03 27:
5f892713c3 2021-03-03 28: % Singular value decomposition of a matrix.
5f892713c3 2021-03-03 29: a := mat((1,3),(-4,3));
5f892713c3 2021-03-03 30: write "Singular Value Decomposition of a:"$
5f892713c3 2021-03-03 31: svd(a);