The code in Context("Matrix") appears to work and produces the right answers, but I get the error message

### PG warning message------

---- main (eval 982) 774 ------This does not appear to be a matrix

The code appears below

DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(

"PG.pl",

"MathObjects.pl",

"PGbasicmacros.pl",

"PGanswermacros.pl",

"PGmatrixmacros.pl",

"PGcourse.pl",

);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("Matrix");

$a=non_zero_random(-3,3,1);

$c=non_zero_random(-3,3,1);

$b=-$c-2+$a*$c;

$A = Matrix([$a, $b, 1], [-1, 1, -1], [1, $c, 0]);

$A_inv = Compute($A->inverse);

BEGIN_TEXT

This problem is related to Problem 5.21 in the text.

$PAR

Given the matrix $BR

A = \{ mbox( display_matrix($A), "," ) \}

$BR

(a) does the inverse of the matrix exist?

$BR

Your answer is (input Yes or No): \{ans_rule(15) \}

$BR

(b) if your answer is Yes, write the inverse here; if the answer is NO, enter all zeros here:

$BR

\( A^{-1} = \) \{ mbox( answer_matrix(3,3,10), "." ) \}

END_TEXT

$ans0 = "Yes";

ANS(str_cmp($ans0));

ANS num_cmp(ra_flatten_matrix($A_inv));

Context()->texStrings;

SOLUTION(EV3(<<'END_SOLUTION'));

$PAR

$BBOLD SOLUTION $EBOLD

$PAR

The matrix is invertible $BR

\( A^{-1} = \) \{ mbox( display_matrix($A_inv) )\}

END_SOLUTION

ENDDOCUMENT(); # This should be the last executable line in the problem.

loadMacros(

"PG.pl",

"MathObjects.pl",

"PGbasicmacros.pl",

"PGanswermacros.pl",

"PGmatrixmacros.pl",

"PGcourse.pl",

);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("Matrix");

$a=non_zero_random(-3,3,1);

$c=non_zero_random(-3,3,1);

$b=-$c-2+$a*$c;

$A = Matrix([$a, $b, 1], [-1, 1, -1], [1, $c, 0]);

$A_inv = Compute($A->inverse);

BEGIN_TEXT

This problem is related to Problem 5.21 in the text.

$PAR

Given the matrix $BR

A = \{ mbox( display_matrix($A), "," ) \}

$BR

(a) does the inverse of the matrix exist?

$BR

Your answer is (input Yes or No): \{ans_rule(15) \}

$BR

(b) if your answer is Yes, write the inverse here; if the answer is NO, enter all zeros here:

$BR

\( A^{-1} = \) \{ mbox( answer_matrix(3,3,10), "." ) \}

END_TEXT

$ans0 = "Yes";

ANS(str_cmp($ans0));

ANS num_cmp(ra_flatten_matrix($A_inv));

Context()->texStrings;

SOLUTION(EV3(<<'END_SOLUTION'));

$PAR

$BBOLD SOLUTION $EBOLD

$PAR

The matrix is invertible $BR

\( A^{-1} = \) \{ mbox( display_matrix($A_inv) )\}

END_SOLUTION

ENDDOCUMENT(); # This should be the last executable line in the problem.