# [LON-CAPA-users] Simplifying polynomial expressions

Seema Ali sali at vsb.bc.ca
Mon Nov 5 23:11:27 EST 2012

```I'd like to create dynamic polynomial questions that require students to simplify them. I was wondering how to do I check to see if the students actually entered a simplified version of the expression, but keep it still free enough to allow the order of terms to be different.

For example:
1. 3a + 2b - 4a + 6b
Students could enter: -a + 8*b, or 8*b - a, or -1*a + 8*b, or 8*b + -a, etc for it to be correct.
I'm concerned that a student could also enter equivalent unsimplified responses like:
3*a + 2*b - 4*a + 6*b or -a + 2b + 6b and still have it marked correctly.

I'd like to create a variety of short answer polynomial questions, but I'm not sure how much work it will be.

The code below contains an example with a,b,c variables. It creates polynomials and it marks it correct if the answer entered is equivalent to the question, not necessarily the simplified form.

Any insight on this will be appreciated.

<problem>
<script type="loncapa/perl">\$coeff_a1 = &random(-1,1,2)*&random(2,10,1);
\$coeff_a2 = &random(-1,1,2)*&random(2,10,1);
\$coeff_b1 = &random(-1,1,2)*&random(2,10,1);
\$coeff_b2 = &random(-1,1,2)*&random(2,10,1);
\$coeff_c1 = &random(-1,1,2)*&random(2,10,1);
\$coeff_c2 = &random(-1,1,2)*&random(2,10,1);

\$answer = &cas('maxima', "\$coeff_a1*a + \$coeff_b1*b + \$coeff_c1*c + \$coeff_a2*a + \$coeff_b2*b + \$coeff_c2*c");

<m eval='on'>
\[\Large
\$coeff_a1 a + \$coeff_b1 b + \$coeff_c1 c + \$coeff_a2 a + \$coeff_b2 b + \$coeff_c2 c
\]
</m>

<br />
g(x) := LONCAPALIST[1];
<hintgroup showoncorrect="no">
<startouttext />

<endouttext />
</hintgroup>
</mathresponse>
</problem>

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20121106/14693cd7/attachment-0001.html>
```