Difference between revisions of "MatrixOperations1"
Paultpearson (talk | contribs) |
(add historical tag and give links to newer problems.) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/LinearAlgebra/MatrixOperations.html a newer version of this problem]</p> |
||
+ | |||
<h2>Matrix Operations</h2> |
<h2>Matrix Operations</h2> |
||
Line 6: | Line 10: | ||
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixOperations1.pg FortLewis/Authoring/Templates/LinAlg/MatrixOperations1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixOperations1.pg FortLewis/Authoring/Templates/LinAlg/MatrixOperations1.pg] |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixOperations1_PGML.pg FortLewis/Authoring/Templates/LinAlg/MatrixOperations1_PGML.pg] |
||
* More problems like this in the OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/Hope/Multi1/02-01-Matrix-operations/ Hope/Multi1/02-01-Matrix-operations/] |
* More problems like this in the OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/Hope/Multi1/02-01-Matrix-operations/ Hope/Multi1/02-01-Matrix-operations/] |
||
Latest revision as of 05:24, 18 July 2023
This problem has been replaced with a newer version of this problem
Matrix Operations
This PG code shows how to assess whether a student knows whether two matrices can be multiplied and, when the matrix product exists, what the dimensions of a matrix product are.
- File location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixOperations1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixOperations1_PGML.pg
- More problems like this in the OPL: Hope/Multi1/02-01-Matrix-operations/
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserPopUp.pl", "AnswerFormatHelp.pl", "PGcourse.pl", ); $showPartialCorrectAnswers = 0; TEXT(beginproblem()); |
Initialization:
We use |
Context('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)], ]); $B = 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)], ]); $popup = PopUp(['Choose','True','False'],'False'); |
Setup: Create two 2 by 3 matrices and a true/false popup. |
Context()->texStrings; BEGIN_TEXT Let \[ A = $A,\] \[ B = $B.\] If possible, compute the following. If an answer does not exist, enter ${BBOLD}DNE${EBOLD}. $BR $BR \( AB = \) \{ ans_box(3,30).$SPACE.AnswerFormatHelp('matrices') \} $BR $BR \( BA = \) \{ ans_box(3,30).$SPACE.AnswerFormatHelp('matrices') \} $BR $BR \{ $popup->menu \} True or False: For any two matrices \( A \) and \( B \), both of the products \( AB \) and \( BA \) are always defined. END_TEXT Context()->normalStrings; |
Main Text:
Use |
install_problem_grader(~~&std_problem_grader); ANS( ($A * $B)->cmp() ); ANS( Compute('DNE')->cmp() ); ANS( $popup->cmp ); COMMENT('MathObject version.'); ENDDOCUMENT(); |
Answer Evaluation:
Use the standard problem grader, which awards full credit only when all answers are correct and zero credit otherwise. Although it would have been better coding practice to construct the matrix product |