Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
3774 views
ubuntu2004
1
load("__common__.sage")
2
3
def generator():
4
# create a 4x4 or 5x3 matrix
5
rows = randrange(3,5)
6
columns = 8-rows
7
8
#start with nice RREF
9
max_number_of_pivots = min(rows,columns)
10
number_of_pivots = randrange(2,max_number_of_pivots+1)
11
A = simple_random_matrix_of_rank(number_of_pivots,rows=rows,columns=columns,augmented=True)
12
13
#Choose prompt
14
prompt = choice(["system","vectoreq"])
15
16
# Get RREF
17
rref = copy(A.echelon_form())
18
19
20
return {
21
'system': latex_system_from_matrix(A),
22
'matrix': A,
23
'rref': rref,
24
'solution': latex_solution_set_from_matrix(A),
25
'prompt_system': prompt=='system',
26
'prompt_vectoreq': prompt=='vectoreq',
27
'vectoreq': vectorEquation(A)
28
}
29
30