Difference between revisions of "MatrixAnswer1"
Paultpearson (talk | contribs) m |
(add historical tag and give links to newer problems.) |
||
(2 intermediate revisions 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/MatrixAnswer1.html a newer version of this problem]</p> |
||
+ | |||
+ | |||
<h2>Answer is a Matrix 1</h2> |
<h2>Answer is a Matrix 1</h2> |
||
Line 6: | Line 11: | ||
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1.pg FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1.pg FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1.pg] |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1_PGML.pg FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 80: | Line 86: | ||
<b>Setup:</b> |
<b>Setup:</b> |
||
Use <code>Context("Matrix");</code>. |
Use <code>Context("Matrix");</code>. |
||
− | + | MathObject matrices are constructed using the <code>Matrix()</code> constructor. |
|
The matrix A has two rows and three columns, and is constructed by <code>[ [row 1 entries], [row 2 entries] ]</code>, and this construction generalizes in the obvious way. |
The matrix A has two rows and three columns, and is constructed by <code>[ [row 1 entries], [row 2 entries] ]</code>, and this construction generalizes in the obvious way. |
||
If a matrix has only one row, such as B, then it is entered as <code>[row 1 entries]</code> and <b>not</b> as <code>[ [row 1 entries] ]</code>. |
If a matrix has only one row, such as B, then it is entered as <code>[row 1 entries]</code> and <b>not</b> as <code>[ [row 1 entries] ]</code>. |
Latest revision as of 05:23, 18 July 2023
This problem has been replaced with a newer version of this problem
Answer is a Matrix 1
This PG code shows how to evaluate answers that are matrices.
- File location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/LinAlg/MatrixAnswer1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", ); TEXT(beginproblem()); |
Initialization: |
Context("Matrix"); $A = Matrix([ [random(-5,5,1),random(-5,5,1),random(-5,5,1)], [random(-5,5,1),random(-5,5,1),random(-5,5,1)], ]); $B = Matrix([random(-5,5,1),random(-5,5,1),random(-5,5,1)]); $answer = $A * ($B->transpose); |
Setup:
Use |
Context()->texStrings; BEGIN_TEXT Suppose \[ A = $A \ \ \mbox{and} \ \ B = $B. \] Evaluate the following matrix product. $BR $BR \( A B^T = \) \{ $answer->ans_array(5) \} \{ AnswerFormatHelp("matrices") \} END_TEXT Context()->normalStrings; |
Main Text:
Use the |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp() ); |
Answer Evaluation: Use standard MathObject answer evaluation. |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |