diff --git a/source/common/sagemath/library.sage b/source/common/sagemath/library.sage index 2aa4e192a..4241ada9a 100644 --- a/source/common/sagemath/library.sage +++ b/source/common/sagemath/library.sage @@ -576,6 +576,18 @@ class TBIL: string+=latex(self.vectors[-1]) return string + #Vector equation class + class LinearCombinationFromMatrix(LinearCombination): + def __init__(self,A,vars=None): + A=A.subdivision(0,0) # ignores augmented matrices + if vars is None: + self.coefficients=[var(f"x_{i}") for i in range(1,len(A.columns())+1)] + else: + self.coefficients=[vars[:len(A.columns())]] + self.vectors=[column_matrix(v) for v in A.columns()] + self.length=min(len(self.coefficients),len(self.vectors)) + self.parentheses=False + #Generic equation, which could be used with polynomial or matrix equations. Often used with a LinearCombination passed as leftside class Equation(SageObject): def __init__(self,leftside,rightside): diff --git a/source/linear-algebra/exercises/outcomes/EV/EV1/generator.sage b/source/linear-algebra/exercises/outcomes/EV/EV1/generator.sage index aee75e831..a498fd309 100644 --- a/source/linear-algebra/exercises/outcomes/EV/EV1/generator.sage +++ b/source/linear-algebra/exercises/outcomes/EV/EV1/generator.sage @@ -9,6 +9,10 @@ class Generator(BaseGenerator): a,b,c,d = var("a b c d") ls = [a,b,c,d][:rows] + # roll different statements + statements = [f"statement{l}" for l in "ABCDEF"] + shuffle(statements) + #start with nice RREF number_of_pivots = 2 A = CheckIt.simple_random_matrix_of_rank(number_of_pivots,rows=rows,columns=columns) @@ -32,14 +36,16 @@ class Generator(BaseGenerator): for i in range(number_of_pivots) ], ) - matrix = A.augment(column_matrix(lin_combo), subdivide=True) + A_aug = A.augment(column_matrix(lin_combo), subdivide=True) vectors = [ { "v": column_matrix(lin_combo), "lin_combo": True, "lin_combo_exp": lin_combo_exp, - "A": matrix, - "rref": matrix.rref(), + "A": A_aug, + "rref": A_aug.rref(), + "veceq": TBIL.VectorEquation(A_aug), + statements[0]: True, } ] @@ -53,13 +59,15 @@ class Generator(BaseGenerator): choice([-1,1]) for _ in range(rows) ]) - matrix = A.augment(column_matrix(non_lin_combo), subdivide=True) + A_aug = A.augment(column_matrix(non_lin_combo), subdivide=True) vectors += [ { "v": column_matrix(non_lin_combo), "lin_combo": False, - "A": matrix, - "rref": matrix.rref(), + "A": A_aug, + "rref": A_aug.rref(), + "veceq": TBIL.VectorEquation(A_aug), + statements[1]: True, } ] @@ -72,7 +80,6 @@ class Generator(BaseGenerator): "vectors": vectors, # "combovector": column_matrix(A.column(-1)), # "statement": choice([True,False]), - # "veceq": TBIL.VectorEquation(A), # "matrix": A, # "rref": A.rref(), # "pivots": A.pivots(), diff --git a/source/linear-algebra/exercises/outcomes/EV/EV1/template.xml b/source/linear-algebra/exercises/outcomes/EV/EV1/template.xml index b1404f907..22f08587a 100644 --- a/source/linear-algebra/exercises/outcomes/EV/EV1/template.xml +++ b/source/linear-algebra/exercises/outcomes/EV/EV1/template.xml @@ -16,7 +16,26 @@ that's equivalent to this claim.
The vector equation (...) has at least one solution.
Here's an example of one such statement:
+
+ The vector equation
+
+
+ The following vector equation is consistent:
+
+
+ At least one solution exists for the equation
+
+
+
+
+
+ A minimum of one solution for
+
+
+ We can find at least one vector which solves the equation
+
+
- The vector equation
+
Here's an example of one such statement:
+
+ The vector equation
+
+
+ For any
+
+
+ At least one solution exists for the equation
+
+
+
+
+
+ Given any
+
+
+ We can find at least one vector which solves the equation
+
- The vector equation
+
Here's an example of one such statement:
+
+ The vector equation
+
+
+ The following vector equation is consistent with a unique solution:
+
+
+ Exactly one solution exists for the equation
+
+
+
+
+
+ The unique solution for
+
+
+ There is no vector besides
+
- The vector equation
+
Here's an example of one such statement:
+
+ The vector equation
+
+
+ For any
+
+
+ One and only one solution exists for the equation
+
+
+
+
+
+ Given any
+
+
+ We can find a unique vector which solves the equation
+