# Christian LaChance# using coding to produce vectors and matricies# solve simple linear algebra equations with coding# problem 1 produce a code that creates a vector using any numbers of choicev=vector(QQ,[5,7,-2])print(v)
(5, 7, -2)
# problem 2 produce a code that adds 2 vectors to create a vectorx=vector(QQ,[5,7,-2])y=vector(QQ,[3,-3,9])m=x+yprint(m)
(8, 4, 7)
# problem 3 produce a code that creates a 3 by 3 matrix using any numbers of choicem=matrix(QQ,[[1,-12,0],[8,-2,3],[13,4,-1]])print(m)
[ 1 -12 0]
[ 8 -2 3]
[ 13 4 -1]
# problem 4 produce a code that adds two 3 by 3 matrices togetherm1=matrix(QQ,[[1,-12,0],[8,-2,3],[13,4,-1]])m2=matrix(QQ,[[-4,2,6],[6,7,-3],[-3,7,5]])m=m1+m2print(m)
[ -3 -10 6]
[ 14 5 0]
[ 10 11 4]
# problem 5 produce a code that multiplies three 3 by 3 matrices togetherm1=matrix(QQ,[[1,-12],[8,-2]])m2=matrix(QQ,[[-4,2],[6,7]])m3=matrix(QQ,[[1,-5,-2],[3,2,7],[8,-4,2]])m=m1*m2print(m)