Difference between revisions of "Logarithms1"
(Created page with '<h2>Answer Must Be Simplified Using Logarithms</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1px;padding…') |
Paultpearson (talk | contribs) (Add link to PGML version in OPL) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
This PG code shows how to disable and undefine some functions and operators, which will require students to simplify their answer using laws of logarithms. |
This PG code shows how to disable and undefine some functions and operators, which will require students to simplify their answer using laws of logarithms. |
||
</p> |
</p> |
||
− | * Download file: [[File:Logarithms1.txt]] (change the file extension from txt to pg when you save it) |
||
+ | * File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/Logarithms1.pg FortLewis/Authoring/Templates/Algebra/Logarithms1.pg] |
||
− | * |
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/Logarithms1_PGML.pg FortLewis/Authoring/Templates/Algebra/Logarithms1_PGML.pg] |
<br clear="all" /> |
<br clear="all" /> |
||
Line 46: | Line 46: | ||
"MathObjects.pl", |
"MathObjects.pl", |
||
"AnswerFormatHelp.pl", |
"AnswerFormatHelp.pl", |
||
− | "contextLimitedPowers.pl", |
||
); |
); |
||
Line 87: | Line 86: | ||
<p> |
<p> |
||
<b>Setup:</b> |
<b>Setup:</b> |
||
− | We add the variables to the context and reset their limits since logarithms are not defined on the default domain <code>[-1,1]</code>. <i>After</i> defining <code>$answer</code>, then we undefine certain operators and functions so that students will have to simplify their answer. Since the answer requires multiplication no matter how it is written, we cannot prevent students from entering an answer such as <code>ln(x*x*x...)</code> instead of <code>$a * ln(x)</code>, but by choosing |
+ | We add the variables to the context and reset their limits since logarithms are not defined on the default domain <code>[-1,1]</code>. <i>After</i> defining <code>$answer</code>, then we undefine certain operators and functions so that students will have to simplify their answer. Since the answer requires multiplication no matter how it is written, we cannot prevent students from entering an answer such as <code>ln(x*x*x...)</code> instead of <code>$a * ln(x)</code>, but by choosing large values for <code>$a, $b, $c</code>, we can strongly discourage them from entering <code>ln(x*x*x...)</code>. |
</p> |
</p> |
||
</td> |
</td> |
||
Line 164: | Line 163: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category: |
+ | [[Category:Sample Problems]] |
+ | [[Category:Subject Area Templates]] |
Revision as of 16:56, 7 June 2015
Answer Must Be Simplified Using Logarithms
This PG code shows how to disable and undefine some functions and operators, which will require students to simplify their answer using laws of logarithms.
- File location in OPL: FortLewis/Authoring/Templates/Algebra/Logarithms1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/Logarithms1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", ); TEXT(beginproblem()); |
Initialization: |
Context("Numeric"); Context()->variables->are(x=>"Real",y=>"Real",z=>"Real"); Context()->variables->set(x=>{limits=>[2,3]}); Context()->variables->set(y=>{limits=>[2,3]}); Context()->variables->set(z=>{limits=>[2,3]}); $a = random(20,40,1); $b = random(20,40,1); do { $c = random(20,40,1); } until ( $c != $b ); # TeX $expr = "\displaystyle \ln \left( \frac{ x^{$a} y^{$b} }{ z^{$c} } \right)"; $answer = Compute("$a * ln(x) + $b * ln(y) - $c * ln(z)"); Context()->operators->undefine("/","^","**"); Context()->functions->undefine("sqrt"); |
Setup:
We add the variables to the context and reset their limits since logarithms are not defined on the default domain |
Context()->texStrings; BEGIN_TEXT Using laws of logarithms, write the expression below using sums and/or differences of logarithmic expressions which do not contain the logarithms of products, quotients, or powers. $BR $BR \( \displaystyle $expr = \) \{ ans_rule(40) \} \{ AnswerFormatHelp("formulas") \} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp() ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |