Skip to content

Commit c1d233e

Browse files
add more statements to EV1, EV2, EV4, EV5 (#940)
* add more statements to EV1 * add equations for EV2 * comment in LinearCombinationFromMatrix * add statements for EV4, EV5 * Update source/linear-algebra/exercises/outcomes/EV/EV2/template.xml Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com> * Update source/linear-algebra/exercises/outcomes/EV/EV2/template.xml Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com> * Update source/linear-algebra/exercises/outcomes/EV/EV4/template.xml Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com> * Update source/linear-algebra/exercises/outcomes/EV/EV5/template.xml Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com> * Update source/linear-algebra/exercises/outcomes/EV/EV5/template.xml Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com> * elaborate that we just give one such example --------- Co-authored-by: Drew Lewis <30658947+siwelwerd@users.noreply.github.com>
1 parent e64f84e commit c1d233e

9 files changed

Lines changed: 133 additions & 14 deletions

File tree

source/common/sagemath/library.sage

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,18 @@ class TBIL:
576576
string+=latex(self.vectors[-1])
577577
return string
578578

579+
#Vector equation class
580+
class LinearCombinationFromMatrix(LinearCombination):
581+
def __init__(self,A,vars=None):
582+
A=A.subdivision(0,0) # ignores augmented matrices
583+
if vars is None:
584+
self.coefficients=[var(f"x_{i}") for i in range(1,len(A.columns())+1)]
585+
else:
586+
self.coefficients=[vars[:len(A.columns())]]
587+
self.vectors=[column_matrix(v) for v in A.columns()]
588+
self.length=min(len(self.coefficients),len(self.vectors))
589+
self.parentheses=False
590+
579591
#Generic equation, which could be used with polynomial or matrix equations. Often used with a LinearCombination passed as leftside
580592
class Equation(SageObject):
581593
def __init__(self,leftside,rightside):

source/linear-algebra/exercises/outcomes/EV/EV1/generator.sage

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ class Generator(BaseGenerator):
99
a,b,c,d = var("a b c d")
1010
ls = [a,b,c,d][:rows]
1111

12+
# roll different statements
13+
statements = [f"statement{l}" for l in "ABCDEF"]
14+
shuffle(statements)
15+
1216
#start with nice RREF
1317
number_of_pivots = 2
1418
A = CheckIt.simple_random_matrix_of_rank(number_of_pivots,rows=rows,columns=columns)
@@ -32,14 +36,16 @@ class Generator(BaseGenerator):
3236
for i in range(number_of_pivots)
3337
],
3438
)
35-
matrix = A.augment(column_matrix(lin_combo), subdivide=True)
39+
A_aug = A.augment(column_matrix(lin_combo), subdivide=True)
3640
vectors = [
3741
{
3842
"v": column_matrix(lin_combo),
3943
"lin_combo": True,
4044
"lin_combo_exp": lin_combo_exp,
41-
"A": matrix,
42-
"rref": matrix.rref(),
45+
"A": A_aug,
46+
"rref": A_aug.rref(),
47+
"veceq": TBIL.VectorEquation(A_aug),
48+
statements[0]: True,
4349
}
4450
]
4551

@@ -53,13 +59,15 @@ class Generator(BaseGenerator):
5359
choice([-1,1])
5460
for _ in range(rows)
5561
])
56-
matrix = A.augment(column_matrix(non_lin_combo), subdivide=True)
62+
A_aug = A.augment(column_matrix(non_lin_combo), subdivide=True)
5763
vectors += [
5864
{
5965
"v": column_matrix(non_lin_combo),
6066
"lin_combo": False,
61-
"A": matrix,
62-
"rref": matrix.rref(),
67+
"A": A_aug,
68+
"rref": A_aug.rref(),
69+
"veceq": TBIL.VectorEquation(A_aug),
70+
statements[1]: True,
6371
}
6472
]
6573

@@ -72,7 +80,6 @@ class Generator(BaseGenerator):
7280
"vectors": vectors,
7381
# "combovector": column_matrix(A.column(-1)),
7482
# "statement": choice([True,False]),
75-
# "veceq": TBIL.VectorEquation(A),
7683
# "matrix": A,
7784
# "rref": A.rref(),
7885
# "pivots": A.pivots(),

source/linear-algebra/exercises/outcomes/EV/EV1/template.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,26 @@ that's equivalent to this claim.
1616
</p>
1717
</content>
1818
<outtro>
19-
<p><q>The vector equation (...) has at least one solution.</q></p>
19+
<p>Here's an example of one such statement:
20+
<!-- {{#statementA}} -->
21+
<q>The vector equation <m>{{veceq}}</m> has at least one solution.</q>
22+
<!-- {{/statementA}} -->
23+
<!-- {{#statementB}} -->
24+
<q>The following vector equation is consistent: <m>{{veceq}}</m>.</q>
25+
<!-- {{/statementB}} -->
26+
<!-- {{#statementC}} -->
27+
<q>At least one solution exists for the equation <m>{{veceq}}</m>.</q>
28+
<!-- {{/statementC}} -->
29+
<!-- {{#statementD}} -->
30+
<q><m>{{veceq}}</m> has at least one solution vector.</q>
31+
<!-- {{/statementD}} -->
32+
<!-- {{#statementE}} -->
33+
<q>A minimum of one solution for <m>{{veceq}}</m> can be found.</q>
34+
<!-- {{/statementE}} -->
35+
<!-- {{#statementF}} -->
36+
<q>We can find at least one vector which solves the equation <m>{{veceq}}</m>.</q>
37+
<!-- {{/statementF}} -->
38+
</p>
2039
</outtro>
2140
</knowl>
2241
<knowl>

source/linear-algebra/exercises/outcomes/EV/EV2/generator.sage

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ TBIL.config_matrix_typesetting()
44
class Generator(BaseGenerator):
55
def data(self):
66
A=CheckIt.simple_random_matrix_of_rank(choice([2,3]),rows=4,columns=3)
7+
8+
# roll different statements
9+
statements = [f"statement{l}" for l in "ABCDEF"]
10+
shuffle(statements)
711

812
tasks = [{
913
"spans": False,
1014
"vecset": TBIL.VectorSet(A.columns()),
1115
"matrix": A,
1216
"rref": A.rref(),
17+
statements[0]: True,
18+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
1319
}]
1420

1521
spans = choice([True,False])
@@ -24,6 +30,8 @@ class Generator(BaseGenerator):
2430
"vecset": TBIL.VectorSet(A.columns()),
2531
"matrix": A,
2632
"rref": A.rref(),
33+
statements[1]: True,
34+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
2735
}]
2836

2937
spans = not spans
@@ -38,6 +46,8 @@ class Generator(BaseGenerator):
3846
"vecset": TBIL.VectorSet(A.columns()),
3947
"matrix": A,
4048
"rref": A.rref(),
49+
statements[2]: True,
50+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
4151
}]
4252

4353
shuffle(tasks)

source/linear-algebra/exercises/outcomes/EV/EV2/template.xml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,25 @@
1616
</p>
1717
</content>
1818
<outtro>
19-
<p>
20-
<q>The vector equation <m>(...)=\vec w</m> has at least one solution for every <m>\vec w\in\mathbb R^4</m>.</q>
19+
<p>Here's an example of one such statement:
20+
<!-- {{#statementA}} -->
21+
<q>The vector equation <m>{{veceqleft}}=\vec w</m> has at least one solution for any <m>\vec w\in\mathbb R^4</m>.</q>
22+
<!-- {{/statementA}} -->
23+
<!-- {{#statementB}} -->
24+
<q>For any <m>\vec w\in\mathbb R^4</m>, the following vector equation is consistent: <m>{{veceqleft}}=\vec w</m>.</q>
25+
<!-- {{/statementB}} -->
26+
<!-- {{#statementC}} -->
27+
<q>At least one solution exists for the equation <m>{{veceqleft}}=\vec w</m> for every vector <m>\vec w</m> in <m>\mathbb R^4</m>.</q>
28+
<!-- {{/statementC}} -->
29+
<!-- {{#statementD}} -->
30+
<q><m>{{veceqleft}}=\vec w</m> has at least one solution vector regardless of how <m>\vec w</m> is chosen from <m>\mathbb R^4</m>.</q>
31+
<!-- {{/statementD}} -->
32+
<!-- {{#statementE}} -->
33+
<q>Given any <m>\vec w</m> from <m>\mathbb R^4</m>, a minimum of one solution for <m>{{veceqleft}}=\vec w</m> can be found.</q>
34+
<!-- {{/statementE}} -->
35+
<!-- {{#statementF}} -->
36+
<q>We can find at least one vector which solves the equation <m>{{veceqleft}}=\vec w</m> no matter what <m>\vec w\in\mathbb R^4</m> is.</q>
37+
<!-- {{/statementF}} -->
2138
</p>
2239
</outtro>
2340
</knowl>

source/linear-algebra/exercises/outcomes/EV/EV4/generator.sage

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ TBIL.config_matrix_typesetting()
44
class Generator(BaseGenerator):
55
def data(self):
66
A=CheckIt.simple_random_matrix_of_rank(choice([3,4]),rows=4,columns=5)
7+
8+
# roll different statements
9+
statements = [f"statement{l}" for l in "ABCDEF"]
10+
shuffle(statements)
711

812
tasks = [{
913
"independent": False,
1014
"vecset": TBIL.VectorSet(A.columns()),
1115
"matrix": A,
1216
"rref": A.rref(),
17+
statements[0]: True,
18+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
1319
}]
1420

1521
independent = choice([True,False])
@@ -24,6 +30,8 @@ class Generator(BaseGenerator):
2430
"vecset": TBIL.VectorSet(A.columns()),
2531
"matrix": A,
2632
"rref": A.rref(),
33+
statements[1]: True,
34+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
2735
}]
2836

2937
independent = not independent
@@ -38,6 +46,8 @@ class Generator(BaseGenerator):
3846
"vecset": TBIL.VectorSet(A.columns()),
3947
"matrix": A,
4048
"rref": A.rref(),
49+
statements[2]: True,
50+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
4151
}]
4252

4353
shuffle(tasks)

source/linear-algebra/exercises/outcomes/EV/EV4/template.xml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,25 @@
1616
</p>
1717
</content>
1818
<outtro>
19-
<p>
20-
<q>The vector equation <m>(...)=\vec 0</m> has exactly one solution.</q>
19+
<p>Here's an example of one such statement:
20+
<!-- {{#statementA}} -->
21+
<q>The vector equation <m>{{veceqleft}}=\vec 0</m> has exactly one solution.</q>
22+
<!-- {{/statementA}} -->
23+
<!-- {{#statementB}} -->
24+
<q>The following vector equation is consistent with a unique solution: <m>{{veceqleft}}=\vec 0</m>.</q>
25+
<!-- {{/statementB}} -->
26+
<!-- {{#statementC}} -->
27+
<q>Exactly one solution exists for the equation <m>{{veceqleft}}=\vec 0</m>.</q>
28+
<!-- {{/statementC}} -->
29+
<!-- {{#statementD}} -->
30+
<q><m>{{veceqleft}}=\vec 0</m> can only be solved by the solution vector <m>\vec 0</m>.</q>
31+
<!-- {{/statementD}} -->
32+
<!-- {{#statementE}} -->
33+
<q>The unique solution for <m>{{veceqleft}}=\vec 0</m> is the zero vector.</q>
34+
<!-- {{/statementE}} -->
35+
<!-- {{#statementF}} -->
36+
<q>There is no vector besides <m>\vec 0</m> which solves the equation <m>{{veceqleft}}=\vec 0</m>.</q>
37+
<!-- {{/statementF}} -->
2138
</p>
2239
</outtro>
2340
</knowl>

source/linear-algebra/exercises/outcomes/EV/EV5/generator.sage

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ TBIL.config_matrix_typesetting()
44
class Generator(BaseGenerator):
55
def data(self):
66
A=CheckIt.simple_random_matrix_of_rank(choice([2,3]),rows=4,columns=choice([3,5]))
7+
8+
# roll different statements
9+
statements = [f"statement{l}" for l in "ABCDEF"]
10+
shuffle(statements)
711

812
tasks = [{
913
"basis": False,
1014
"vecset": TBIL.VectorSet(A.columns()),
1115
"matrix": A,
1216
"rref": A.rref(),
17+
statements[0]: True,
18+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
1319
}]
1420

1521
basis = choice([True,False])
@@ -24,6 +30,8 @@ class Generator(BaseGenerator):
2430
"vecset": TBIL.VectorSet(A.columns()),
2531
"matrix": A,
2632
"rref": A.rref(),
33+
statements[1]: True,
34+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
2735
}]
2836

2937
basis = not basis
@@ -38,6 +46,8 @@ class Generator(BaseGenerator):
3846
"vecset": TBIL.VectorSet(A.columns()),
3947
"matrix": A,
4048
"rref": A.rref(),
49+
statements[2]: True,
50+
"veceqleft": TBIL.LinearCombinationFromMatrix(A),
4151
}]
4252

4353
shuffle(tasks)

source/linear-algebra/exercises/outcomes/EV/EV5/template.xml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,25 @@
1616
</p>
1717
</content>
1818
<outtro>
19-
<p>
20-
<q>The vector equation <m>(...)=\vec w</m> has exactly one solution for every <m>\vec w\in\mathbb R^4</m>.</q>
19+
<p>Here's an example of one such statement:
20+
<!-- {{#statementA}} -->
21+
<q>The vector equation <m>{{veceqleft}}=\vec w</m> has a unique solution for any <m>\vec w\in\mathbb R^4</m>.</q>
22+
<!-- {{/statementA}} -->
23+
<!-- {{#statementB}} -->
24+
<q>For any <m>\vec w\in\mathbb R^4</m>, the following vector equation has exactly one solution: <m>{{veceqleft}}=\vec w</m>.</q>
25+
<!-- {{/statementB}} -->
26+
<!-- {{#statementC}} -->
27+
<q>One and only one solution exists for the equation <m>{{veceqleft}}=\vec w</m> for every vector <m>\vec w</m> in <m>\mathbb R^4</m>.</q>
28+
<!-- {{/statementC}} -->
29+
<!-- {{#statementD}} -->
30+
<q><m>{{veceqleft}}=\vec w</m> has a unique solution regardless of how <m>\vec w</m> is chosen from <m>\mathbb R^4</m>.</q>
31+
<!-- {{/statementD}} -->
32+
<!-- {{#statementE}} -->
33+
<q>Given any <m>\vec w</m> from <m>\mathbb R^4</m>, exactly one solution for <m>{{veceqleft}}=\vec w</m> can be found.</q>
34+
<!-- {{/statementE}} -->
35+
<!-- {{#statementF}} -->
36+
<q>We can find a unique vector which solves the equation <m>{{veceqleft}}=\vec w</m> no matter what <m>\vec w\in\mathbb R^4</m> is.</q>
37+
<!-- {{/statementF}} -->
2138
</p>
2239
</outtro>
2340
</knowl>

0 commit comments

Comments
 (0)