1
- sub _MatrixCheckers_init { }; # don't reload this file
2
-
3
- =pod
4
1
5
2
=head1 NAME
6
3
7
- MatrixCheckers.pl
4
+ MatrixCheckers.pl - Provides subroutines for answer checking using MathObjects
5
+ matrices with real entries.
8
6
9
7
=head1 SYNOPSIS
10
8
@@ -17,57 +15,47 @@ =head1 DESCRIPTION
17
15
First, load the C<MatrixCheckers.pl > macro file. If the basis has
18
16
more than one vector, also load C<parserMultiAnswer.pl > .
19
17
20
- =over 12
21
-
22
- =item loadMacros("PGstandard.pl","MathObjects.pl","parserMultiAnswer.pl","MatrixCheckers.pl");
23
-
24
- =back
18
+ loadMacros("PGstandard.pl","MathObjects.pl","parserMultiAnswer.pl","MatrixCheckers.pl");
25
19
26
20
For a matrix that has a single column or row, the way to use the
27
21
answer checkers is the same as using a custom answer checker
28
- inside of C<cmp(checker= > ~~&name_of_answer_checker_subroutine)>
22
+ inside of C<< cmp(checker=>~~&name_of_answer_checker_subroutine) > >
29
23
such as
30
24
31
- =over 12
25
+ ANS( Matrix([[1],[2],[3]])->cmp( checker=>~~&basis_checker_one_column ) );
26
+ ANS( Matrix([[1],[2],[3]])->cmp( checker=>~~&unit_basis_checker_one_column ) );
32
27
33
- =item C<ANS( Matrix([[1],[2],[3]])- > cmp( checker=>~~&basis_checker_one_column ) );>
34
-
35
- =item C<ANS( Matrix([[1],[2],[3]])- > cmp( checker=>~~&unit_basis_checker_one_column ) );>
36
-
37
- =back
38
28
39
29
The "one column" at the end of the checker name refers to the
40
30
fact that the student answer is a one-column matrix. The "unit
41
31
basis checker" ensures that the student answer has unit length.
42
32
33
+ =head2 Checkers
34
+
43
35
For answers that are a collection of column or row vectors, the
44
36
way to use the answer checkers is inside of a MultiAnswer object.
45
37
The macro C<parserMultiAnswer.pl > should also be loaded.
46
38
The answer checkers that should be used inside a MultiAnswer
47
39
object are:
48
40
49
- =over 12
41
+ =head3 basis_checker_columns
50
42
51
- =item C< basis_checker_columns >
43
+ =head3 orthonormal_basis_checker_columns
52
44
53
- =item C< orthonormal_basis_checker_columns >
45
+ =head3 basis_checker_rows
54
46
55
- =item C< basis_checker_rows >
47
+ =head3 orthonormal_basis_checker_rows
56
48
57
- =item C< orthonormal_basis_checker_rows >
49
+ =head3 parametric_plane_checker_columns
58
50
59
- =item C<parametric_plane_checker_columns >
60
-
61
- =back
51
+ =head2 Examples
62
52
63
53
Here is an example of how to use these answer checkers.
64
54
In the setup section of the PG file we create two 3 x 1 MathObject
65
55
matrices with real-entries that serve as basis vectors. The object
66
56
C<$multians > takes the basis vectors as input and passes them
67
57
to the custom answer checker called by C<checker =<gt>...>.
68
58
69
- =over 12
70
-
71
59
$basis1 = Matrix([1/sqrt(2), 0, 1/sqrt(2)])->transpose;
72
60
$basis2 = Matrix([0,1,0])->transpose;
73
61
@@ -79,17 +67,12 @@ =head1 DESCRIPTION
79
67
checker => ~~&orthonormal_basis_checker_columns,
80
68
);
81
69
82
- =back
83
-
84
70
In the main text portion of the PG file, we use C<\{ $multians-<gt>ans_array(15) \}>
85
71
to create an array of text boxes that are 15 characters wide and have square
86
72
brackets around them to look like a matrix. The braces around the vectors, which
87
73
are produced by C<\(\Bigg\lbrace\) > and C<\(\Bigg\rbrace\) > , are a matter of personal
88
74
preference (since a basis is an ordered set, I like to include braces).
89
75
90
-
91
-
92
- Context()->texStrings;
93
76
BEGIN_TEXT
94
77
Find an orthonormal basis for...
95
78
$BR
@@ -101,18 +84,11 @@ =head1 DESCRIPTION
101
84
\(\Bigg\rbrace.\)
102
85
$ECENTER
103
86
END_TEXT
104
- Context()->normalStrings;
105
-
106
-
107
87
108
88
The answer evaluation section of the PG file is totally standard.
109
89
110
- =over 12
111
-
112
90
ANS( $multians->cmp );
113
91
114
- =back
115
-
116
92
The C<parametric_plane_checker_columns > should be used for
117
93
solutions to non-homogeneous systems of linear equations for
118
94
which the solution is essentially a point plus the span of
@@ -122,17 +98,11 @@ =head1 DESCRIPTION
122
98
particular solution), while the remaining vectors are a basis for
123
99
the hyperplane (i.e., they span the homogeneous solution set).
124
100
125
- =head1 AUTHORS
126
-
127
- Paul Pearson, Hope College, Department of Mathematics
128
-
129
101
=cut
130
102
131
- # ###############################################
132
-
133
- loadMacros(" MathObjects.pl" ,); # , will "parserMultiAnswer.pl" create an infinite loop?
103
+ sub _MatrixCheckers_init { }; # don't reload this file
134
104
135
- # ###############################################
105
+ loadMacros( " MathObjects.pl " ,); # , will "parserMultiAnswer.pl" create an infinite loop?
136
106
137
107
sub concatenate_columns_into_matrix {
138
108
@@ -145,8 +115,6 @@ sub concatenate_columns_into_matrix {
145
115
146
116
}
147
117
148
- # #########################################
149
-
150
118
sub basis_checker_one_column {
151
119
152
120
my ($correct , $student , $answerHash ) = @_ ;
@@ -168,8 +136,6 @@ sub basis_checker_one_column {
168
136
169
137
}
170
138
171
- # #########################################
172
-
173
139
sub basis_checker_columns {
174
140
175
141
my ($correct , $student , $answerHash ) = @_ ;
@@ -215,8 +181,6 @@ sub basis_checker_columns {
215
181
216
182
}
217
183
218
- # ############################################
219
-
220
184
sub unit_basis_checker_one_column {
221
185
222
186
my ($correct , $student , $answerHash ) = @_ ;
@@ -236,8 +200,6 @@ sub unit_basis_checker_one_column {
236
200
237
201
}
238
202
239
- # ##############################################
240
-
241
203
sub orthonormal_basis_checker_columns {
242
204
243
205
my ($correct , $student , $answerHash ) = @_ ;
@@ -290,8 +252,6 @@ sub orthonormal_basis_checker_columns {
290
252
291
253
}
292
254
293
- # #############################################
294
-
295
255
sub basis_checker_rows {
296
256
297
257
my ($correct , $student , $answerHash ) = @_ ;
@@ -338,8 +298,6 @@ sub basis_checker_rows {
338
298
339
299
}
340
300
341
- # ############################################
342
-
343
301
sub orthonormal_basis_checker_rows {
344
302
345
303
my ($correct , $student , $answerHash ) = @_ ;
@@ -393,8 +351,6 @@ sub orthonormal_basis_checker_rows {
393
351
394
352
}
395
353
396
- # #############################################
397
-
398
354
sub parametric_plane_checker_columns {
399
355
400
356
my ($correct , $student , $answerHash ) = @_ ;
@@ -457,6 +413,4 @@ sub parametric_plane_checker_columns {
457
413
458
414
}
459
415
460
- # #######################################################
461
-
462
416
1;
0 commit comments