Skip to content

Commit b28e69f

Browse files
authored
Merge pull request #1275 from gajennings/main
Fix issue #1270, update to PGML
2 parents 8806d67 + 26751a1 commit b28e69f

File tree

2 files changed

+45
-76
lines changed

2 files changed

+45
-76
lines changed

OpenProblemLibrary/Hope/Multi1/03-03-Span/Graphical_01/Graphical_01.pg

Lines changed: 45 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
## Linear Algebra
33
## ENDDESCRIPTION
44

5-
65
## DBsubject(Linear algebra)
76
## DBchapter(Euclidean spaces)
87
## DBsection(Linear independence)
@@ -11,24 +10,24 @@
1110
## Level(3)
1211
## MO(1)
1312
## KEYWORDS('linear algebra','vector space','subspaces')
14-
## RESOURCES('basis-2d.png','basis-3d.png','linearly-dependent-2d.png','linearly-dependent-not-spanning-3d.png','linearly-dependent-spanning-3d.png','linearly-independent-not-spanning-3d.png")## Date(July 2013')
13+
## RESOURCES('basis-2d.png','basis-3d.png','linearly-dependent-2d.png','linearly-dependent-not-spanning-3d.png','linearly-dependent-spanning-3d.png','linearly-independent-not-spanning-3d.png")
14+
## Date(July 2013')
1515

1616
DOCUMENT();
1717
loadMacros(
1818
"PGstandard.pl",
19-
"MathObjects.pl",
20-
"PGchoicemacros.pl",
19+
"PGML.pl",
2120
"parserPopUp.pl",
22-
"unionTables.pl",
21+
"niceTables.pl",
2322
"PGcourse.pl"
2423
);
2524
install_problem_grader(~~&std_problem_grader);
2625
$showPartialCorrectAnswers = 0;
2726
$refreshCachedImages = 1;
28-
TEXT(beginproblem());
2927

30-
Context('Matrix');
28+
Context("Numeric");
3129

30+
# six graphics files
3231
@files = (
3332
"basis-2d.png",
3433
"basis-3d.png",
@@ -38,86 +37,56 @@ Context('Matrix');
3837
"linearly-independent-not-spanning-3d.png",
3938
);
4039

40+
#convert files to figures
4141
@fig = ();
42-
foreach my $i (0..$#files) {
43-
$fig[$i] = image($files[$i],width=>200,height=>200,tex_size=>320);
42+
foreach my $file (@files) {
43+
push @fig, image($file,width=>200,height=>200,tex_size=>320);
4444
}
4545

46-
@indep = (
47-
"linearly independent",
48-
"linearly independent",
49-
"linearly dependent",
50-
"linearly dependent",
51-
"linearly dependent",
52-
"linearly independent",
53-
);
46+
#labels (see problem text) of corresponding descriptions of the six files
47+
@labels = ("A","D","A","A","D","C");
5448

55-
@popup_indep = ();
56-
foreach my $i (0..$#indep) {
57-
$popup_indep[$i] = PopUp(['choose','linearly dependent','linearly independent'],$indep[$i]);
49+
#six corresponding answer pop ups
50+
@ans=();
51+
foreach my $label (@labels){
52+
push @ans, PopUp(["??","A","B","C","D"],$label);
5853
}
5954

60-
61-
@span = (
62-
"R^2",
63-
"R^3",
64-
"R^2",
65-
"a 2d plane through the origin inside R^3",
66-
"R^3",
67-
"a 2d plane through the origin inside R^3",
55+
#scramble the answers and figures in the same way
56+
@slice = random_subset(6,(0..5));
57+
@fig = @fig[@slice];
58+
@ans = @ans[@slice];
59+
60+
$table = LayoutTable(
61+
[ [$fig[0], $fig[1], $fig[2] ],
62+
[$ans[0]->menu(), $ans[1]->menu(), $ans[2]->menu() ],
63+
[ $fig[3], $fig[4], $fig[5] ],
64+
[$ans[3]->menu(),$ans[4]->menu(),$ans[5]->menu() ]
65+
]
6866
);
6967

70-
@popup_span = ();
71-
foreach my $i (0..$#span) {
72-
$popup_span[$i] = PopUp(['choose','a line through the origin inside R^2',"R^2","a 2d plane through the origin inside R^3","R^3",],$span[$i]);
73-
}
68+
BEGIN_PGML
69+
A set of two, three, or four red vectors in [``\mathbb{R}^2``] or [``\mathbb{R}^3``] is shown in each figure below. Below the six figures is a list of four descriptions, labeled [`A,\cdots,D`], that may describe the *span* of the vectors in the figures. In the selection box below each figure choose the letter of the description that matches the figure. *Note:* For pictures in [``\mathbb{R}^3 ``], a grid is drawn in the [`xy`]-plane, and vectors with their tip on the grid are in the [`xy`]-plane, while vectors with their tip not on the grid are not in the \(xy\)-plane.
7470

7571

76-
@basis = (
77-
"basis",
78-
"basis",
79-
"not a basis",
80-
"not a basis",
81-
"not a basis",
82-
"not a basis",
83-
);
72+
[@ $table @]*
8473

85-
@popup_basis = ();
86-
foreach my $i (0..$#indep) {
87-
$popup_basis[$i] = PopUp(['choose','basis','not a basis'],$basis[$i]);
88-
}
74+
Descriptions
8975

90-
@perm = shuffle(scalar(@files));
91-
92-
@fig = @fig[@perm];
93-
@popup_indep = @popup_indep[@perm];
94-
@popup_span = @popup_span[@perm];
95-
@popup_basis = @popup_basis[@perm];
96-
97-
98-
Context()->texStrings;
99-
BEGIN_TEXT
100-
A set of two, three, or four red vectors in \( \mathbb{R}^2 \) or \( \mathbb{R}^3 \) is shown in each picture below.
101-
Choose the correct description of the span of each set of vectors.
102-
Note: For the pictures in \( \mathbb{R}^3 \), a grid is drawn in the \(xy\)-plane, and vectors
103-
with their tip on the grid are in the \(xy\)-plane, while vectors with their tip not on the grid are
104-
not in the \(xy\)-plane.
105-
\{
106-
BeginTable().
107-
AlignedRow([$fig[0],$fig[1],$fig[2]]).
108-
TableSpace(5,0).
109-
AlignedRow([$popup_span[0]->menu,$popup_span[1]->menu,$popup_span[2]->menu]).
110-
TableSpace(25,6).
111-
AlignedRow([$fig[3],$fig[4],$fig[5]]).
112-
TableSpace(5,0).
113-
AlignedRow([$popup_span[3]->menu,$popup_span[4]->menu,$popup_span[5]->menu]).
114-
EndTable();
115-
\}
116-
END_TEXT
117-
Context()->normalStrings;
118-
119-
foreach my $i (0..$#popup_span) {
120-
ANS( $popup_span[$i]->cmp );
121-
}
76+
A. The vectors span [``\mathbb{R}^2``].
77+
78+
B. The vectors span a line through the origin inside [``\mathbb{R}^2``].
79+
80+
C. The vectors span a 2-dimensional plane through the origin inside [``\mathbb{R}^3``] but the plane is not [``\mathbb{R}^2``].
81+
82+
D. The vectors span [``\mathbb{R}^3``].
83+
END_PGML
84+
85+
ANS($ans[0]->cmp());
86+
ANS($ans[1]->cmp());
87+
ANS($ans[2]->cmp());
88+
ANS($ans[3]->cmp());
89+
ANS($ans[4]->cmp());
90+
ANS($ans[5]->cmp());
12291

12392
ENDDOCUMENT();
10.3 KB
Loading

0 commit comments

Comments
 (0)