WeBWorK Problems

Q: random polynomial

Re: Q: random polynomial

by Dick Lane -
Number of replies: 0
Two minor revisions:

## inhibit rearrangement
Context() -> reduction -> set( '(-x)+y' => 0, '(-x)-y' => 0 ) ;

## repeat reduction of $poly to remove parentheses
## around constant if it is the last term
$poly = Compute( "$poly" ) -> reduce ;

I suspect the first use of reduce would replace "+ (-5 x^0)" with "+ (-5)" and the second reduce yields "- 5".  It is unclear why the second step is not needed if the constant is not the last term.