Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
3774 views
ubuntu2004
1
load("__common__.sage")
2
3
def generator():
4
l = choice([-1,1])*randrange(1,5)
5
dim = randrange(1,4)
6
A=simple_random_matrix_of_rank(4-dim,rows=4,columns=4)
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