MatrixCustomAnswerChecker1
Paultpearson (Talk  contribs) (Add new matrices and custom answer checkers template) 
Paultpearson (Talk  contribs) m 

(One intermediate revision by one user not shown)  
Line 6:  Line 6:  
</p>  </p>  
* File location in OPL: [https://github.com/openwebwork/webworkopenproblemlibrary/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1.pg FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1.pg]  * File location in OPL: [https://github.com/openwebwork/webworkopenproblemlibrary/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1.pg FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1.pg]  
+  * PGML location in OPL: [https://github.com/openwebwork/webworkopenproblemlibrary/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1_PGML.pg FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1_PGML.pg]  
<br clear="all" />  <br clear="all" /> 
Latest revision as of 15:22, 14 June 2015
Matrices and Custom Answer Checkers
This PG code shows how to use a multianswer answer checker to evaluate an openended question about matrices.
 File location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1.pg
 PGML location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixCustomAnswerChecker1_PGML.pg
PG problem file  Explanation 

Problem tagging: 

DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserMultiAnswer.pl", "AnswerFormatHelp.pl", "PGcourse.pl", ); $showPartialCorrectAnswers = 0; TEXT(beginproblem()); 
Initialization: 
Context('Matrix'); $A = Matrix([[1,1],[0,1]]); $B = Matrix([[1,0],[1,1]]); $multians = MultiAnswer($A, $B)>with( singleResult => 1, checker => sub { my ( $correct, $student, $answerHash ) = @_; my @s = @{$student}; $s0 = Matrix($s[0]); $s1 = Matrix($s[1]); return $s0 * $s1 != $s1 * $s0; } ); 
Setup:
Construct two matrices 
Context()>texStrings; BEGIN_TEXT Give an example of two \( 2 \times 2 \) matrices \( A \) and \( B \) such that \( AB \ne BA \). $BR $BR \( A = \) \{ $multians>ans_array(5) \} $BR $BR \( B = \) \{ $multians>ans_array(5) \} END_TEXT Context()>normalStrings; 
Main Text:
Make sure that both answer arrays are called as methods on the 
install_problem_grader(~~&std_problem_grader); ANS( $multians>cmp() ); COMMENT('MathObject version.'); ENDDOCUMENT(); 
Answer Evaluation: 