Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 1794
Image: ubuntu2004
1
load("__common__.sage")
2
3
def generator():
4
l = choice([-1,1])*randrange(1,5)
5
dim = randrange(1,4)
6
A = random_matrix(QQ,4,algorithm="echelonizable",rank=4-dim,upper_bound=9)
7
B = A+l*identity_matrix(4)
8
9
#Find kernel basis
10
basis = A.right_kernel(basis='pivot').basis()
11
12
return {
13
"matrix": B,
14
"eigenvalue": l,
15
"basis": vectorSet(basis),
16
"matrix-minus-lambda":A,
17
"rref": A.rref(),
18
}
19
20