Difference between revisions of "LimitedPowers"
Jump to navigation
Jump to search
m (2 revisions: import all default namespace pages from old wiki) |
|||
(One intermediate revision by one other user not shown) | |||
Line 68: | Line 68: | ||
<b>Setup:</b> |
<b>Setup:</b> |
||
This is the section where we restrict the allowed types of powers. |
This is the section where we restrict the allowed types of powers. |
||
− | For more options, see the POD documentation [http://webwork.maa.org/ |
+ | For more options, see the POD documentation [http://webwork.maa.org/pod/pg/macros/contextLimitedPowers.html contextLimitedPowers.pl] |
</p> |
</p> |
||
</td> |
</td> |
||
Line 127: | Line 127: | ||
<ul> |
<ul> |
||
− | <li>POD documentation: [http://webwork.maa.org/ |
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/contextLimitedPowers.html contextLimitedPowers.pl]</li> |
− | <li>PG macro: [http:// |
+ | <li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/contextLimitedPowers.pl?view=log contextLimitedPowers.pl]</li> |
</ul> |
</ul> |
Latest revision as of 16:55, 7 April 2021
Restricting Allowed Powers (Exponents) in Student Answers
This PG code shows how to restrict the allowed powers in student answers.
You may also be interested in other limited contexts DisableFunctions
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGcourse.pl", "contextLimitedPowers.pl", ); TEXT(beginproblem()); |
Initialization:
Use |
Context("Numeric"); #LimitedPowers::NoBaseE(); # chose one of these three: #LimitedPowers::OnlyIntegers(); LimitedPowers::OnlyPositiveIntegers(); #LimitedPowers::OnlyNonNegativeIntegers(); $a = random(2,5,1); |
Setup: This is the section where we restrict the allowed types of powers. For more options, see the POD documentation contextLimitedPowers.pl |
Context()->texStrings; BEGIN_TEXT (a) Enter \( $a^3 \): \{ ans_rule(10) \} $BR (b) Enter \( 1/$a^3 \), not \( $a^{-3} \): \{ ans_rule(10) \} $BR (c) Enter \( 1/x^2 \), not \( x^{-2} \): \{ ans_rule(10) \} END_TEXT Context()->normalStrings; |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ANS( Real("$a^3")->cmp() ); ANS( Real("1/$a^3")->cmp() ); ANS( Compute("1/x^2")->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: contextLimitedPowers.pl
- PG macro: contextLimitedPowers.pl