Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168727
Image: ubuntu2004
a=matrix(2,2,(1,5,-1,2));a #initialize a 2x2 matrix
[ 1 5] [-1 2]
b=matrix(2,2,(-2,1,1,1));b #initialize a 2x2 matrix
[-2 1] [ 1 1]
c=a+b;c #find a matrix sum
[-1 6] [ 0 3]
d=b-a;d #find a matrix difference
[-3 -4] [ 2 -1]
e=a*b;e #show matrix products are not commutative
[3 6] [4 1]
f=b*a;f #show matrix products are not commutative
[-3 -8] [ 0 7]
g=a**2;g #square a matrix
[-4 15] [-3 -1]
h=b**3;h #cube a matrix
[-11 4] [ 4 1]
i=a^(-1);i #find the inverse of a matrix
[ 2/7 -5/7] [ 1/7 1/7]
j=b**(-1);j.n() #find the inverse of a matrix
[-0.333333333333333 0.333333333333333] [ 0.333333333333333 0.666666666666667]
k=det(a);k #find the determinant of a matrix
7
l=b.det();l #find the determinant of a matrix
-3