DomainRange1

From WeBWorK_wiki
Revision as of 21:59, 4 December 2010 by Pearson (talk | contribs) (Created page with '<h2>Domain and Range of a Function</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> Thi…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Domain and Range of a Function

Click to enlarge

This PG code shows how to evaluate answers that are inequalities which use different variables.

  • Download file: File:DomainRange1.txt (change the file extension from txt to pg when you save it)
  • File location in NPL: FortLewis/Authoring/Templates/Precalc/DomainRange1.pg


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"contextInequalities.pl",
"AnswerFormatHelp.pl",
);

TEXT(beginproblem());

Initialization:

Context("Numeric");

$f = Compute("sqrt(x-4)");

Context("Inequalities-Only")->variables->are(x=>"Real");
$domain = Compute("x >= 4");

Setup 1:

Context()->texStrings;
BEGIN_TEXT
Suppose \( f(x) = $f \).  Enter inequalities for the 
domain and range of \( f \).
$BR
$BR
Domain: 
\{ ans_rule(20) \}
\{ AnswerFormatHelp("inequalities") \}
$BR
END_TEXT
Context()->normalStrings;

Main Text 1:

$showPartialCorrectAnswers = 1;

ANS( $domain->cmp() );

Answer Evaluation 1:

Context("Inequalities-Only")->variables->are(y=>"Real");

$range  = Compute("y >= 0");

Setup 2:

Context()->texStrings;
BEGIN_TEXT
Range:$SPACE$SPACE
\{ ans_rule(20) \}
\{ AnswerFormatHelp("inequalities") \}
END_TEXT
Context()->normalStrings;

Main Text 2:

ANS( $range ->cmp() );

Answer Evaluation 2:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area