ExpandedPolynomial1: Difference between revisions
Jump to navigation
Jump to search
(Created page with '<h2>Polynomial Multiplication (Expanding)</h2> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> This PG code shows how to require students to expand poly…') |
No edit summary |
||
Line 45: | Line 45: | ||
"MathObjects.pl", | "MathObjects.pl", | ||
"contextLimitedPolynomial.pl", | "contextLimitedPolynomial.pl", | ||
); | ); | ||
Line 55: | Line 53: | ||
<p> | <p> | ||
<b>Initialization:</b> | <b>Initialization:</b> | ||
</p> | </p> | ||
</td> | </td> | ||
Line 69: | Line 66: | ||
# | # | ||
Context("Numeric"); | Context("Numeric"); | ||
$h = 3; | |||
$k = 5; | |||
$h = | |||
$k = | |||
$vertexform = Compute("(x-$h)^2-$k"); | $vertexform = Compute("(x-$h)^2-$k"); | ||
Line 80: | Line 74: | ||
# | # | ||
Context("LimitedPolynomial-Strict"); | Context("LimitedPolynomial-Strict"); | ||
$ | $b = -2 * $h; | ||
$c = $h**2 - $k; | |||
$expandedform = Formula("x^2 | $expandedform = Formula("x^2 + $b x + $c")->reduce(); | ||
</pre> | </pre> | ||
</td> | </td> | ||
Line 99: | Line 82: | ||
<p> | <p> | ||
<b>Setup:</b> | <b>Setup:</b> | ||
We use the <code>LimitedPolynomial-Strict</code> context, construct the coefficients <code>$b</code> and <code>$c</code> as Perl reals, and then construct <code>$expandedform</code> using these pre-computed coefficients. This is because the LimitedPolynomial-Strict context balks at answers that are not already simplified completely. | |||
</p> | </p> | ||
</td> | </td> | ||
Line 118: | Line 95: | ||
BEGIN_TEXT | BEGIN_TEXT | ||
The quadratic expression \( $vertexform \) | The quadratic expression \( $vertexform \) | ||
is written in vertex form. | is written in vertex form. Write the | ||
expression in expanded form | |||
\( ax^2 + bx + c \). | |||
$BR | $BR | ||
$BR | $BR | ||
\{ ans_rule(30) \} | \{ ans_rule(30) \} | ||
END_TEXT | END_TEXT | ||
Context()->normalStrings; | Context()->normalStrings; | ||
Line 137: | Line 107: | ||
<p> | <p> | ||
<b>Main Text:</b> | <b>Main Text:</b> | ||
To help students understand how to format their answers, we give an example <code>ax^2+bx+c</code> of what the answer should look like. | |||
</p> | </p> | ||
</td> | </td> | ||
Line 150: | Line 120: | ||
ANS( $expandedform->cmp() ); | ANS( $expandedform->cmp() ); | ||
</pre> | </pre> |
Revision as of 17:29, 1 December 2010
Polynomial Multiplication (Expanding)
This PG code shows how to require students to expand polynomial multiplication.
- Download file: File:ExpandedPolynomial1.txt (change the file extension from txt to pg when you save it)
- File location in NPL:
NationalProblemLibrary/FortLewis/Authoring/Templates/Algebra/ExpandedPolynomial1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "contextLimitedPolynomial.pl", ); TEXT(beginproblem()); |
Initialization: |
# # Vertex form # Context("Numeric"); $h = 3; $k = 5; $vertexform = Compute("(x-$h)^2-$k"); # # Expanded form # Context("LimitedPolynomial-Strict"); $b = -2 * $h; $c = $h**2 - $k; $expandedform = Formula("x^2 + $b x + $c")->reduce(); |
Setup:
We use the |
Context()->texStrings; BEGIN_TEXT The quadratic expression \( $vertexform \) is written in vertex form. Write the expression in expanded form \( ax^2 + bx + c \). $BR $BR \{ ans_rule(30) \} END_TEXT Context()->normalStrings; |
Main Text:
To help students understand how to format their answers, we give an example |
$showPartialCorrectAnswers = 1; ANS( $expandedform->cmp() ); |
Answer Evaluation: Everything is as expected. |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |