WeBWorK Problems

matrices with algebraic entries

matrices with algebraic entries

by Siman Wong -
Number of replies: 0
I'm writing Webwork problems whose solutions are matrices whose entries are variables (but not algebraic expressions in the variables), like e, x_0, x_1, ..., x_n.

<p>

(1) How do I handle subscripts? I tried

<p>

$ans1 = Compute("x0")->reduce();
<br>
ANS($ans1->cmp());

<p>

but Webwork treats it as x*0, which is not good.

<p>

(2) The matrices have fixed size, say 4x4. Is it possible to store the students' input as entries of a 2-dimensional array as oppose to 16 different variables? (e.g a[1][1], a[1][2], etc)

<p>

(3) Assuming that I can store the student input as an array a[i][j], is it possible to check the answer by running through a loop? e.g. to check that it is symmetric I would do something like this:

<p>
flag=1;
<br>
for i=2 to n
<br>
for j=1 to n-1
<br>
if a[i][j] != a[j][i] then flag=0;
<br>
end;
<br>
end;
<br>
if flag==0 then CORRECT else WRONG
<p>

(this is just an example; I need to check something more complicated)

MANY THANKS!