PrimeOperator: Difference between revisions
Jump to navigation
Jump to search
(New page: <h2>Prime Operator (Differentiation)</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> <em>Thi...) |
No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 123: | Line 123: | ||
<ul> | <ul> | ||
<li>POD documentation: [http://webwork.maa.org/ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/parserPrime.html parserPrime.pl]</li> | ||
<li>PG macro: [http:// | <li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserPrime.pl?view=log parserPrime.pl]</li> | ||
</ul> | </ul> | ||
Latest revision as of 22:06, 7 April 2021
Prime Operator (Differentiation)
This PG code shows how to allow the prime operator for differentiation.
| PG problem file | Explanation |
|---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserPrime.pl", "parserAssignment.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("Numeric")->variables->add(y=>"Real");
Context()->constants->add(k=>0.01);
Context()->flags->set(formatStudentAnswer=>'parsed');
parser::Assignment->Allow;
# only use partial derivatives with respect to x
parser::Prime->Enable("x");
$answer1 = Formula("y = k x'");
$answer2 = Formula("(x^2)' + (y^2)'");
parser::Prime->Disable;
|
Setup: We need to enable the prime operator, and ought to also specify the variable for partial differentiation. |
BEGIN_TEXT
Enter the equation \( y = k x' \) or \( y = k \):
\{ ans_rule(20) \}
$PAR
Since we defined the prime operator as the partial
derivative with respect to \( x \),
enter the expression \( (x^2+y^2)' \) or \( 2x \):
\{ ans_rule(20) \}
END_TEXT
|
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ANS( $answer1->cmp() ); ANS( $answer2->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: parserPrime.pl
- PG macro: parserPrime.pl