I'm just trying to write a simple problem where the students perform matrix operations. I put variable names in the matrices. But I continue to run into problems with this.
a) I tried to have WebWork calculate the transpose of a matrix, but I got the error "Can't locate object method "transpose" via package "Value::Formula"" which makes it sound as if I can't use matrix operations with variable names in them.
b) So I punted and just entered the transpose myself, but now when I have WebWork display the matrices so the students can enter them, the ones with variables in them don't display as a matrix, but simply as a single blank. See attached image.
I have tried looking to see if I need to include some other pl file so that I can do this, but the documentation doesn't mention it.
c) Is there a better way to do the 'impossible' case?
Thanks, as always, for the help on this. I'm sure it is just something I am not seeing, but after 45 minutes of debugging this problem (I had other issues before I could get this far) I just need to take a break.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGcourse.pl",
"PGessaymacros.pl",
"MathObjects.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context('Matrix')->variables->are(c=>'Real',d=>'Real',x=>'Real',y=>'Real', 'm'=>'Real','p'=>'Real', 'r'=>'Real','u'=>'Real', 'v'=>'Real','w'=>'Real');
$A = Matrix( [1,2], ["c", "d"] );
$B = Matrix( [3, "x", "y"], [1, 4, 0] );
$C = Matrix([ [2,5], ["m", "p"], ["r", "u"]]);
$D = Matrix(["u", 2, 0], [1, "v", 0], [0, 1, "w"]);
$Imp = Matrix([[-1,-1], [-1, -1], [-1, -1]]);
$D2 = Matrix(" $D * $D");
$AB = Matrix("$A*$B");
$CT = Matrix([ [2, "m", "r"], [5, "p", "u"]]);
$BmCT = Matrix("$B - $CT");
Context()->texStrings;
BEGIN_TEXT
Let \[A = $A,\ B = $B,\ C = $C \text{ and } D = $D.\]
$BR $BR
a) \(D^2 = \) \{ $D2->ans_array \}
$BR
$BR
b) \( AB = \) \{ $AB->ans_array \}
$BR$BR
c) \(B^TC = \) \{ $Imp->ans_array \}
$BR
$BR
d) \(B - C^T = \) \{ $BmCT->ans_array \}
$BR$BR
e) If any of the calculations were impossible, explain why.
\{essay_box(8,48)\}
$BR$BR
These last question will be graded by the instructor. You will not get immediate feedback.
END_TEXT
Context()->normalStrings;
ANS($D2->cmp);
ANS($AB->cmp);
ANS($Imp->cmp);
ANS($BmCT->cmp);
ANS(essay_cmp());
COMMENT('MathObject version');
ENDDOCUMENT();