Difference between revisions of "RowOperations1"
Jump to navigation
Jump to search
Paultpearson (talk | contribs) (New row operations question) |
Paultpearson (talk | contribs) m |
||
Line 67: | Line 67: | ||
$A = Matrix([ |
$A = Matrix([ |
||
− | [ |
+ | [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], |
− | [ |
+ | [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], |
− | [ |
+ | [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], |
]); |
]); |
||
Revision as of 22:10, 28 June 2014
Row Operations
This PG code shows how to ask students to compute the result of elementary row operations.
- File location in OPL: FortLewis/Authoring/Templates/LinAlg/RowOperations1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGcourse.pl", ); $showPartialCorrectAnswers = 0; TEXT(beginproblem()); |
Initialization: |
Context('Matrix'); do { $A = Matrix([ [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], [non_zero_random(-5,5,1),non_zero_random(-5,5,1)], ]); } until (($A->row(1) != $A->row(2)) && ($A->row(1) != $A->row(3)) && ($A->row(2) != $A->row(3))); $k = random(2,9,1); $op = "R_{1} + $k R_{2} \rightarrow R_{1}"; $answer = Matrix([ $A->row(1) + $k*($A->row(2)), $A->row(2), $A->row(3), ]); |
Setup: |
Context()->texStrings; BEGIN_TEXT Give the result of applying the row operation \( $op \) to the given matrix. $BR $BR \( $A \mathop{\longrightarrow}^{$op} \) \{ $answer->ans_array \} END_TEXT Context()->normalStrings; |
Main Text: |
ANS( $answer->cmp() ); COMMENT('MathObject version.'); ENDDOCUMENT(); |
Answer Evaluation: |