Difference between revisions of "DomainRange1"
(Hide link to non-PGML file on GitHub.) |
|||
Line 5: | Line 5: | ||
This PG code shows how to evaluate answers that are inequalities which use different variables. |
This PG code shows how to evaluate answers that are inequalities which use different variables. |
||
</p> |
</p> |
||
− | * File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Precalc/DomainRange1.pg FortLewis/Authoring/Templates/Precalc/DomainRange1.pg] |
+ | <!--* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Precalc/DomainRange1.pg FortLewis/Authoring/Templates/Precalc/DomainRange1.pg]--> |
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Precalc/DomainRange1_PGML.pg FortLewis/Authoring/Templates/Precalc/DomainRange1_PGML.pg] |
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Precalc/DomainRange1_PGML.pg FortLewis/Authoring/Templates/Precalc/DomainRange1_PGML.pg] |
||
Revision as of 07:06, 11 March 2023
Domain and Range of a Function
This PG code shows how to evaluate answers that are inequalities which use different variables.
- PGML location in OPL: FortLewis/Authoring/Templates/Precalc/DomainRange1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( 'PGstandard.pl', 'MathObjects.pl', 'contextInequalities.pl', 'PGML.pl', 'PGcourse.pl' ); TEXT(beginproblem()); |
Initialization:
We must load |
$f = Compute('sqrt(x-4)'); Context('Inequalities-Only')->variables->are(x=>'Real'); Context()->flags->set(formatStudentAnswer=>'parsed'); $domain = Compute('x >= 4'); # the context needs to change for the range Context('Inequalities-Only')->variables->are(y=>'Real'); Context()->flags->set(formatStudentAnswer=>'parsed'); $range = Compute('y >= 0'); |
Setup:
We specify the context in a way that requires students to enter their answer using inequalities and the variable x. If we had used
We use For the domain, since the variable is now y, we must reset the context and the variable so that students must enter the variable y in their answer. |
BEGIN_PGML Suppose [` f(x) = [$f] `]. Enter inequalities for the domain and range of [` f `]. - Domain: [_______]{$domain} - Range: [_________________]{$range} [@ helpLink('inequalities') @]* END_PGML |
Main Text: |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION |
Solution: |