WeBWorK Problems

error messages for matrix answers

Re: error messages for matrix answers

by Davide Cervone -
Number of replies: 0
Here is a version that sets the error message that you requested.
    ANS(Matrix([[1,2]])->cmp(
      showDimensionHints => 0,
      checker=>sub {
        ($correct,$student,$ans) = @_;
        my $isSquare = $student->isSquare;
        $ans->{ans_message} = "Your matrix has a determinant"
           if $isSquare && !$ans->{isPreview};
        return !$isSquare;
      }
    ));