EquationImplicitFunction1
Answer is an Equation that Implicitly Defines a Function
This PG code shows how to have an answer that is an equation that implicitly defines a function.
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl', 'parserImplicitEquation.pl','PGML.pl','PGcourse.pl'); TEXT(beginproblem()); |
Initialization: |
Context('ImplicitEquation'); Context()->{error}{msg}{ "Can't find any solutions to your equation"} = ' '; Context()->{error}{msg}{ "Can't generate enough valid points for comparison"} = ' '; Context()->variables->set( x=>{limits=>[-6,11]}, y=>{limits=>[-6,11]}, ); $a = random(1,5,1); $b = random(1,5,1); $r = random(2,5,1); $p = Compute("($a,$b)"); $answer = ImplicitEquation( "(x-$a)^2 + (y-$b)^2 = $r^2", solutions=>[ [$a,$b+$r], [$a,$b-$r], [$a+$r,$b], [$a-$r,$b], [$a+$r*sqrt(2)/2,$b+$r*sqrt(2)/2], ] ); |
Setup:
We quash some error messages by redefining them to be a blank string
If your equation is linear of the form |
BEGIN_PGML Enter an equation for a circle in the [`xy`]-plane of radius [` [$r] `] centered at [` [$p] `]. [________________________]{$answer} [@ helpLink('equation') @]* END_PGML |
Main Text: |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |