I am attempting to write a problem that asks for the student to write the system of equations that corresponds to an augmented matrix. I have code below that does this using implicit planes as long as the student enters actual implicit planes. It also allows them to leave one blank if the equation is not really there due to a whole row of zeros. I wouldn't mind any suggestions to do this better if you have any, but that is not my main concern.

The primary issue is that a student could very well enter 1x = 0, 0 = 0, 0x = 0, 0x+0y+0z = 0, 0 = 1, 0x = 1, etc., which throws an error. However, it is actually desirable to allow them to enter such "equations" because it is often the case to have such situations. For the problem below, the matrix is nonzero throughout, but I'd like to be able to write a couple problems where I have only one nonzero number in the last row (to cover cases of 1x = 0, 0x = 1, 1 = 0, 0 = 1, etc.) or all zeros (to cover 0x = 0, 0 = 0, etc.). Is this possible?

My initial thought is to send string answers to the multi answer checker and somehow parse them. However, I'm not sure how to 1) actually parse them properly to allow for all the different variations of variables and numbers that can show up and 2) this would get rid of the error feedback the students get for implicit planes, which I don't necessarily want. Any suggestions would be greatly appreciated. Thank you so much!

P.S. Off topic, but if Davide happens to see this or if someone else knows, I'd love to know how to put my code in a gray box like a html code block. For some reason <code></code> doesn't work for me and I don't see it in the editor options? =)

```
## DESCRIPTION
## only accepts the exact equations from which the augmented matrix came from
## including signs of numbers and equation order
##
## Randomization:
##
##
## ENDDESCRIPTION
## Author('Richard G. Lynch')
################################################################################
# Initialization
################################################################################
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"parserImplicitPlane.pl",
"PGchoicemacros.pl",
"parserMultiAnswer.pl",
);
TEXT(beginproblem());
################################################################################
# Problem Setup
################################################################################
Context("ImplicitPlane")->variables->add(y=>"Real",z=>"Real");
Context()->noreduce('(-x)-y','(-x)+y');
do {
@n = ((2..9),(2..9),(-9,-2),(2..9),(-9,-2),(-9,-2)); @n = @n[shuffle(scalar(@n))];
($a,$b,$c,$d,$e,$f,$g,$h,$i) = @n[0..8];
$det = Matrix([$a,$b,$c],[$d,$e,$f],[$g,$h,$i])->det;
} until ($det != 0);
@b = (random(21,89)*random(-1,1,2),random(11,20)*random(-1,1,2),random(21,29))[shuffle(3)];
$eq1 = ImplicitPlane("$a x + $b y + $c z = $b[0]");
$eq2 = ImplicitPlane("$d x + $e y + $f z = $b[1]");
$eq3 = ImplicitPlane("$g x + $h y + $i z = $b[2]");
# count correct if the system they put in has this exact augmented matrix
$ma = MultiAnswer($eq1,$eq2,$eq3)->with(
checkTypes => 0,
singleResult => 0,
allowBlankAnswers => 1,
checker => sub {
my ($correct,$student,$self) = @_;
my ($s1,$s2,$s3) = @{$student};
my ($c1,$c2,$c3) = @{$correct};
if ((ref($s1) ne ref($c1) && ref($s1) ne ref(String(""))) ||
(ref($s2) ne ref($c1) && ref($s2) ne ref(String(""))) ||
(ref($s3) ne ref($c1) && ref($s3) ne ref(String("")))) {
if (ref($s1) ne ref($c1)) {
$self->setMessage(1,'You may enter only equations or leave the blank empty');
}
if (ref($s2) ne ref($c1)) {
$self->setMessage(2,'You may enter only equations or leave the blank empty');
}
if (ref($s3) ne ref($c1)) {
$self->setMessage(3,'You may enter only equations or leave the blank empty');
}
return [0,0,0];
}
@corr = (1,1,1);
if (ref($s1) ne ref(String(""))) {
my $sN = $s1->{N};
my @sR = (Vector(1,0,0).$s1N,Vector(0,1,0).$s1N,Vector(0,0,1).$s1N,$s1->{d});
my $cN = $c1->{N};
my @cR = (Vector(1,0,0).$c1N,Vector(0,1,0).$c1N,Vector(0,0,1).$c1N,$c1->{d});
foreach $i (0..3) {$corr[0] = 0 if $sR[$i] != $cR[$i]};
} else {
$corr[0] = 0;
}
if (ref($s2) ne ref(String(""))) {
my $sN = $s2->{N};
my @sR = (Vector(1,0,0).$s2N,Vector(0,1,0).$s2N,Vector(0,0,1).$s2N,$s2->{d});
my $cN = $c1->{N};
my @cR = (Vector(1,0,0).$c2N,Vector(0,1,0).$c2N,Vector(0,0,1).$c2N,$c2->{d});
foreach $i (0..3) {$corr[1] = 0 if $sR[$i] != $cR[$i]};
} else {
$corr[1] = 0;
}
if (ref($s3) ne ref(String(""))) {
my $sN = $s3->{N};
my @sR = (Vector(1,0,0).$s3N,Vector(0,1,0).$s3N,Vector(0,0,1).$s3N,$s3->{d});
my $cN = $c3->{N};
my @cR = (Vector(1,0,0).$c3N,Vector(0,1,0).$c3N,Vector(0,0,1).$c3N,$c3->{d});
foreach $i (0..3) {$corr[2] = 0 if $sR[$i] != $cR[$i]};
} else {
$corr[2] = 0;
}
return [@corr];
}
);
################################################################################
# Text
################################################################################
BEGIN_PGML
Write the system of linear equations which has
[`\quad \left[\begin{array}{rrr|r}
[$a] & [$b] & [$c] &[$b[0]] \\
[$d] & [$e] & [$f] &[$b[1]] \\
[$g] & [$h] & [$i] &[$b[2]]
\end{array}\right]\quad`]
as its corresponding augmented matrix.
Assume the variables are [`x`], [`y`] and [`z`]. You may not need to fill in
all of the blanks to have your answer counted as correct.
[__]{$ma}
[__]{$ma}
[__]{$ma}
END_PGML
################################################################################
# Answers and Solutions
################################################################################
#BEGIN_HINT
#END_HINT
#BEGIN_PGML_SOLUTION
#END_PGML_SOLUTION
ENDDOCUMENT();
```