## WeBWorK Problems

by Nandor Sieben -
Number of replies: 2
I'd like to use Compute("[[1/2,1],[1,1]]") so that the fraction is visible in the correct answer field after submission. Unfortunately the correct answer is displayed as [[1/2,1],[1,1]] instead of a matrix.

If I use Matrix([[1/2,1],[1,1]]), then the correct answer is displayed as a matrix but the fraction becomes 0.5.

How can I keep both the fraction and the matrix form in the correct answer field?

### Re: Compute, Matrix, correct answer

by Nandor Sieben -
I only have this problem if the matrix is part of a MultiAnswer. If I use it regularly, then the Compute is displayed as a matrix as expected. So this is probably a bug for displaying Compute matrix answers inside a MultiAnswer.
For example, I can reproduce your results only when singleResult=>1 is used with the MultiAnswer object. That is important information that we would have had if you had provided a full example.
The issue is due to the fact that when the MultiAnswer object was written, the correct answer in the result table was not displayed in typeset form, but was always an answer string like what a student would enter. The TeX version was added fairly recently, and MultiAnswer hasn't been updated to accommodate that. If you use singleResult => 0, it will format as you want it to, but the single-result version doesn't generate the required TeX form.
I've attached an updated copy of parserMultiAnswer.pl that should take care of the problem.