Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 1794
Image: ubuntu2004
1
load("__common__.sage")
2
3
def generator():
4
# create a mxn standard matrix
5
columns = randrange(3,5)
6
rows = choice([7,8])-columns
7
A = random_matrix(QQ,rows,columns,algorithm='echelonizable',rank=choice([min(rows,columns),min(rows,columns)-1]),upper_bound=9)
8
9
10
if len(A.pivots())==columns:
11
injective=true
12
else:
13
injective=false
14
15
if len(A.pivots())==rows:
16
surjective=true
17
else:
18
surjective=false
19
20
return {
21
"matrix": A,
22
"columns": columns,
23
"rows": rows,
24
"rref": A.rref(),
25
"injective": injective,
26
"surjective": surjective
27
}
28
29