Difference between revisions of "FunctionDecomposition1"
Jump to navigation
Jump to search
Line 17: | Line 17: | ||
<tr valign="top"> |
<tr valign="top"> |
||
− | <th> PG problem file </th> |
+ | <th style="width: 40%"> PG problem file </th> |
<th> Explanation </th> |
<th> Explanation </th> |
||
</tr> |
</tr> |
||
Line 44: | Line 44: | ||
loadMacros( |
loadMacros( |
||
− | + | 'PGstandard.pl', |
|
− | + | 'MathObjects.pl', |
|
− | + | 'answerComposition.pl', |
|
− | + | 'PGML.pl', |
|
+ | 'PGcourse.pl' |
||
); |
); |
||
− | |||
TEXT(beginproblem()); |
TEXT(beginproblem()); |
||
</pre> |
</pre> |
||
Line 88: | Line 87: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML |
||
− | BEGIN_TEXT |
||
+ | Express the function [` y = \sqrt{ x^2 + [$a] } `] |
||
− | Express the function \( y = \sqrt{ x^2 + $a } \) |
||
+ | as a composition [` y = f(g(x)) `] of two simpler |
||
− | as a composition \( y = f(g(x)) \) of two simpler |
||
+ | functions [` y = f(u) `] and [` u = g(x) `]. |
||
− | functions \( y = f(u) \) and \( u = g(x) \). |
||
+ | |||
− | $BR |
||
+ | + [` f(u) = `] [_______________] |
||
− | $BR |
||
+ | |||
− | \( f(u) \) = \{ ans_rule(20) \} |
||
+ | + [` g(x) = `] [_______________] |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
+ | |||
− | $BR |
||
+ | [@ helpLink('formula') @]* |
||
− | \( g(x) \) = \{ ans_rule(20) \} |
||
+ | END_PGML |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
− | END_TEXT |
||
− | Context()->normalStrings; |
||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
Line 132: | Line 128: | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> |
<td style="background-color:#ddddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML_SOLUTION |
||
− | BEGIN_SOLUTION |
||
− | ${PAR}SOLUTION:${PAR} |
||
Solution explanation goes here. |
Solution explanation goes here. |
||
− | END_SOLUTION |
||
+ | END_PGML_SOLUTION |
||
− | Context()->normalStrings; |
||
− | |||
− | COMMENT('MathObject version.'); |
||
ENDDOCUMENT(); |
ENDDOCUMENT(); |
Revision as of 12:33, 10 March 2023
Function Decomposition
This PG code shows how to check student answers that are a composition of functions.
- File location in OPL: FortLewis/Authoring/Templates/Precalc/FunctionDecomposition1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Precalc/FunctionDecomposition1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( 'PGstandard.pl', 'MathObjects.pl', 'answerComposition.pl', 'PGML.pl', 'PGcourse.pl' ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("Numeric"); Context()->variables->add(u=>"Real"); $a = random(2,9,1); $f = Formula("sqrt(u)"); $g = Formula("x^2+$a"); |
Setup: |
BEGIN_PGML Express the function [` y = \sqrt{ x^2 + [$a] } `] as a composition [` y = f(g(x)) `] of two simpler functions [` y = f(u) `] and [` u = g(x) `]. + [` f(u) = `] [_______________] + [` g(x) = `] [_______________] [@ helpLink('formula') @]* END_PGML |
Main Text: |
$showPartialCorrectAnswers = 1; COMPOSITION_ANS( $f, $g, vars=>['u','x'], showVariableHints=>1); |
Answer Evaluation:
We use the |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |