AndradeGonzalez-wp2017/07/Solutions #07/matrices/#07 matrices .sagews

30 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2017-11-21 16:43:05 +01:00
︠10a3b9c6-1411-4852-afb5-11c9e958e9bfs︠
A = Matrix([[1,-4,7],[14,6,8],[-4,-1,2]])
print A
︡b09e747f-98a3-4b68-9179-1d6d1a145b8a︡{"stdout":"[ 1 -4 7]\n[14 6 8]\n[-4 -1 2]\n"}︡{"done":true}︡
︠88b3a883-118e-4fc1-8545-6b4fed43c685s︠
B = Matrix([[2,3,9],[-1,17,6],[0,5,-7]])
print B
︡66652c65-8b89-4dcf-9037-de49e560d755︡{"stdout":"[ 2 3 9]\n[-1 17 6]\n[ 0 5 -7]\n"}︡{"done":true}︡
︠4f23bb26-c323-4264-93e6-6ac97cf3242es︠
'''product of matrices A*B '''
A*B
︡c250a709-cf04-4e75-a284-6ba8ee817326︡{"stdout":"'product of matrices A*B '\n"}︡{"stdout":"[ 6 -30 -64]\n[ 22 184 106]\n[ -7 -19 -56]\n"}︡{"done":true}︡
︠fd3ea861-cdc8-471a-9baa-adae42638186s︠
'''Find determinant of A'''
A.det()
︡dc2acbbd-f9f7-44c0-92d0-8a2774eae88b︡{"stdout":"'Find determinant of A'\n"}︡{"stdout":"330\n"}︡{"done":true}︡
︠29ed34bd-49fa-4e77-8c64-cf30c7faf5e7s︠
''' inverse of B'''
B.transpose()
︡b86e062a-fd7d-4d91-a44c-d9855ba2f62d︡{"stdout":"' inverse of B'\n"}︡{"stdout":"[ 2 -1 0]\n[ 3 17 5]\n[ 9 6 -7]\n"}︡{"done":true}︡