Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Christian Seberino - Number of replies: 5Re: Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Robin Cruz -Christian,
If you are dealing with polynomials, Davide Cervone wrote a specialized context to handle the issues you've mentioned: contextLimitedPolynomial.pl.
The answers must be a polynomials with simplified coefficients and all like terms combined. You can find documentation for specialized contexts at:
http://webwork.maa.org/wiki/Specialized_contexts
--Robin Cruz
Here's an example:----------------------------------------------
DOCUMENT();loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"contextLimitedPolynomial.pl");
TEXT(beginproblem());
######################################
# Setup
($a1,$a0) = (random(3,7,1), non_zero_random(1,5,1));
($b1,$b0) = (non_zero_random(1,2,1),non_zero_random(1,5,1));
$poly1 = Formula("$a1 x + $a0")->reduce;
$poly2 = Formula("$b1 x + $b0")->reduce;
######################################
# Main text
Context()->texStrings;
BEGIN_TEXT
Multiply the polynomials: \( ( $poly1 ) ( $poly2 ) \)
$PAR
Answer: \{ ans_rule(40) \}
END_TEXT
Context()->normalStrings;
######################################
# Answer
Context("LimitedPolynomial-Strict");
($c2,$c1,$c0) = ($a1*$b1,$a1*$b0+$a0*$b1,$a0*$b0);
$ans = Formula("$c2*x^2 + $c1*x + $c0")->reduce;
ANS($ans->cmp);
ENDDOCUMENT();
Re: Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Christian Seberino -Re: Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Davide Cervone -contextPolynomialFactors.pl
and contextRationalFunction.pl
. The first is a context in which students are encouraged to enter polynomials in factored form, and the second is one in which they can enter quotients of polynomials. Both include options for controlling how strict the requirements are. See the POD documentation for these for details.While the
RationalFunction-Strict
context may be what you want to use, it may still be possible for students to type unreduced answers. The MathObjects library is not a full-fledged computer algebra system, and the operations it performs are pretty simple-minded. As you say, true simplification is a non-trivial action, and is outside the scope of MathObjects.Davide
Re: Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Christian Seberino -Re: Possible to mandate algebraic expressions be fully simplified? (not same as reduced)
by Davide Cervone -Davide