I would like to make a list/array of the symbols
but webwork does not seem to like the minus signs; I keep getting the error message Operands of '*' can't be words; see position 1 of formula at line 35 of [TMPL]/PS-Cosets/cosets-problem1-1-header.pg Died within main::List called at line 35 of [TMPL]/PS-Cosets/cosets-problem1-1-header.pg If I remove the minus signs in line 35 then the codes go through...
I must have messed up the syntax somewhere; any suggestions and comments are most welcome. THANKS! p.s. could someone tell me how to force the "plain text mode" in the message editor? ----------------------------------------------------------------
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PG.pl",
"PGstandard.pl",
"MathObjects.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl"
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context()->strings->add(i=>{});
Context()->strings->add(j=>{});
Context()->strings->add("-"=>{});
Context()->strings->add(k=>{});
$q = random(0,1,1);
if($q == 0){
@set = (i, j, j, "j", k, "k");
}
elsif($q == 1){
@set = (i,"i", i,"i",-1, 1);
}
@ans2 = ();
for($i=2;$i<scalar(@set);$i++){
@ans2[$i-2] = $set[$i];
}
$answer2 = List($set[0], $set[1], $set[2], $set[3]);
BEGIN_TEXT
(ii) \(G =\) the quaternion group \(\mathbb{Q}_{8} = $LB 1, -1, i, -i, j, -j, k, -k $RB\) $BR
\( \) \( \) \( \) \( \) \( \) \(H = $set[0]\) $BR
\( \) \( \) \( \) \( \) \( \) \(g\) \( \) \(= $set[1]\)$BR $BR
\{ans_rule(10)\} $BR $BR
END_TEXT
ANS( $answer2->cmp(unordered=>1) );