Difference between revisions of "Spacecurve1"
Paultpearson (talk | contribs) m (Deprecate examples using LiveGraphics3D) |
(add historical tag and give links to newer problems.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <h2>Deprecated: A Parametric Curve in Space</h2> |
||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Parametric/SpaceCurve.html a newer version of this problem]</p> |
||
+ | |||
+ | <h2>A Parametric Curve in Space</h2> |
||
[[File:Spacecurve1.png|300px|thumb|right|Click to enlarge]] |
[[File:Spacecurve1.png|300px|thumb|right|Click to enlarge]] |
||
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> |
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> |
||
− | This PG code shows how to ask a parametric curve question with three answer blanks and use MultiAnswer to check the answer |
+ | This PG code shows how to ask a parametric curve question with three answer blanks and use MultiAnswer to check the answer. |
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Parametric/Spacecurve1.pg FortLewis/Authoring/Templates/Parametric/Spacecurve1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Parametric/Spacecurve1.pg FortLewis/Authoring/Templates/Parametric/Spacecurve1.pg] |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Parametric/Spacecurve1_PGML.pg FortLewis/Authoring/Templates/Parametric/Spacecurve1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 15: | Line 20: | ||
<tr valign="top"> |
<tr valign="top"> |
||
− | <th> PG problem file </th> |
+ | <th style="width: 40%"> PG problem file </th> |
<th> Explanation </th> |
<th> Explanation </th> |
||
</tr> |
</tr> |
||
Line 42: | Line 47: | ||
loadMacros( |
loadMacros( |
||
− | + | 'PGstandard.pl', |
|
− | + | 'MathObjects.pl', |
|
− | + | 'parserMultiAnswer.pl', |
|
− | + | 'PGML.pl', |
|
+ | 'PGcourse.pl' |
||
); |
); |
||
Line 102: | Line 107: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML |
||
− | BEGIN_TEXT |
||
+ | Find a parametrization of the curve [` x = [$a] z^2 `] |
||
− | Find a parametrization of the curve \( x = $a z^2 \) |
||
+ | in the [`xz`]-plane. Use [` t `] as the |
||
− | in the \(xz\)-plane. Use \( t \) as the |
||
parameter for all of your answers. |
parameter for all of your answers. |
||
− | $BR |
||
+ | |||
− | $BR |
||
+ | - [` x(t) = `] [______________]{$multians} |
||
− | + | - [` y(t) = `] [______________]{$multians} |
|
− | + | - [` z(t) = `] [______________]{$multians} |
|
− | + | ||
− | + | [@ helpLink('formulas') @]* |
|
− | + | END_PGML |
|
− | $BR |
||
− | \( z(t) = \) \{$multians->ans_rule(20)\} |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
− | END_TEXT |
||
− | Context()->normalStrings; |
||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
<p> |
<p> |
||
<b>Main Text:</b> |
<b>Main Text:</b> |
||
− | Notice that we use <code>$multians |
+ | Notice that we use <code>$multians</code> in each answer blank because they results in the three answers are dependent on each other. |
− | </p> |
||
− | </td> |
||
− | </tr> |
||
− | |||
− | <!-- Answer evaluation section --> |
||
− | |||
− | <tr valign="top"> |
||
− | <td style="background-color:#eeddff;border:black 1px dashed;"> |
||
− | <pre> |
||
− | $showPartialCorrectAnswers = 0; |
||
− | |||
− | ANS($multians->cmp()); |
||
− | </pre> |
||
− | <td style="background-color:#eeccff;padding:7px;"> |
||
− | <p> |
||
− | <b>Answer Evaluation:</b> |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 128: | Line 132: | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> |
<td style="background-color:#ddddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML_SOLUTION |
||
− | BEGIN_SOLUTION |
||
Solution explanation goes here. |
Solution explanation goes here. |
||
− | END_SOLUTION |
||
+ | END_PGML_SOLUTION |
||
− | Context()->normalStrings; |
||
− | |||
− | COMMENT('MathObject version.'); |
||
ENDDOCUMENT(); |
ENDDOCUMENT(); |
Latest revision as of 06:50, 18 July 2023
This problem has been replaced with a newer version of this problem
A Parametric Curve in Space
This PG code shows how to ask a parametric curve question with three answer blanks and use MultiAnswer to check the answer.
- File location in OPL: FortLewis/Authoring/Templates/Parametric/Spacecurve1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Parametric/Spacecurve1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( 'PGstandard.pl', 'MathObjects.pl', 'parserMultiAnswer.pl', 'PGML.pl', 'PGcourse.pl' ); TEXT(beginproblem()); |
Initialization:
Since we will have multiple answer blanks that depend on each other, we need to use |
Context("Numeric"); Context()->variables->are(t=>"Real"); Context()->variables->set(t=>{limits=>[0,10]}); $a = random(-5,-2,1); $x = Formula("$a * t**2"); $y = Formula("0"); $z = Formula("t"); $multians = MultiAnswer($x, $y, $z)->with( singleResult => 1, checker => sub { my ( $correct, $student, $self ) = @_; my ( $xstu, $ystu, $zstu ) = @{$student}; return 0 unless $xstu->isFormula; if (($xstu==$a*$zstu**2) && ($ystu==0)) { return 1; } else { return 0; } } ); |
Setup:
We use |
BEGIN_PGML Find a parametrization of the curve [` x = [$a] z^2 `] in the [`xz`]-plane. Use [` t `] as the parameter for all of your answers. - [` x(t) = `] [______________]{$multians} - [` y(t) = `] [______________]{$multians} - [` z(t) = `] [______________]{$multians} [@ helpLink('formulas') @]* END_PGML |
Main Text:
Notice that we use |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |