Sharedsupport / 2015-03-06-180258-rank.sagewsOpen in CoCalc
Authors: Harald Schilly, ℏal Snyder, William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
m = matrix([ [(-3/10), (1/5), (1/10)], [(1/5), (-2/5), (2/5)], [(1/10), (1/5), (-1/2)] ]) n = matrix([ [-0.3, 0.2, 0.1], [0.2, -0.4, 0.4], [0.1, 0.2, -0.5] ])
m
[-3/10 1/5 1/10] [ 1/5 -2/5 2/5] [ 1/10 1/5 -1/2]
n
[-0.300000000000000 0.200000000000000 0.100000000000000] [ 0.200000000000000 -0.400000000000000 0.400000000000000] [ 0.100000000000000 0.200000000000000 -0.500000000000000]
m.echelon_form()
[ 1 0 -3/2] [ 0 1 -7/4] [ 0 0 0]
n.echelon_form()
[ 1.00000000000000 0.000000000000000 0.000000000000000] [0.000000000000000 1.00000000000000 0.000000000000000] [0.000000000000000 0.000000000000000 1.00000000000000]
n.det()
1.04083408558608e-17
n.det() == 0
False
a = n.numpy() import numpy numpy.rank(a)
2
numpy.rank(numpy.zeros((1,2,4)))
3