WeBWorK Problems

Function form not flexible when using parserAssignment?

Function form not flexible when using parserAssignment?

by Paul Seeburger -
Number of replies: 0
Hello!

I am editing a Diff. eq. problem by Paul Pearson that uses parserAssignment.  The problem is:
Library/FortLewis/DiffEq/2-Higher-order/02-Linear-2nd-order-cc/Lebl-2-2-08.pg

When the particular solution is, y=6e^(5x)30xe^(5x),for some reason, it is marking the student incorrect when they leave the answer this way, rather than factoring out the GCF as:   y=6e^(5x)(1 −5x).

The relevant code is below:

Context("Numeric");
Context()->variables->add(
'c1'=>"Real",'c2'=>"Real",y=>"Real",
);
Context()->variables->set('c1'=>{limits=>[2,4]},'c2'=>{limits=>[2,4]});
parser::Assignment->Allow;

$a  = random(3,7,1);
do { $y0 = random(2,7,1); } until ($y0 != $a);

# char poly (r-$a)^2
$a2 = 2*$a;
$aa = $a*$a;

$A = $y0;
$B = -($a)*$y0;

$diffeq = "y^{\,\prime\prime} - $a2 y^{\,\prime} + $aa y = 0"; # tex

$answera = Compute("y = (c1 + c2 x) e^($a x)");

$answerb = Compute("y = ($A + $B x) e^($a x)")->reduce;

...

ANS( $answerb->cmp() );

Any ideas would be appreciated!

Thanks!

Paul