Difference between revisions of "VectorParametric1"
(add historical tag and give links to newer problems.) |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Parametric/VectorParametricFunction.html a newer version of this problem]</p> |
||
+ | |||
<h2>A Vector Parametric Curve in the Plane</h2> |
<h2>A Vector Parametric Curve in the Plane</h2> |
||
Line 5: | Line 9: | ||
This PG code shows how to ask students for a vector parametric curve through two points and allows them to specify the time interval. |
This PG code shows how to ask students for a vector parametric curve through two points and allows them to specify the time interval. |
||
</p> |
</p> |
||
− | * Download file: [[File:VectorParametric1.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/Parametric/VectorParametric1.pg FortLewis/Authoring/Templates/Parametric/VectorParametric1.pg] |
||
− | * File location in NPL: <code>FortLewis/Authoring/Templates/Parametric/VectorParametric1.pg</code> |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Parametric/VectorParametric1_PGML.pg FortLewis/Authoring/Templates/Parametric/VectorParametric1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 173: | Line 177: | ||
Context()->texStrings; |
Context()->texStrings; |
||
BEGIN_SOLUTION |
BEGIN_SOLUTION |
||
− | ${PAR}SOLUTION:${PAR} |
||
Solution explanation goes here. |
Solution explanation goes here. |
||
END_SOLUTION |
END_SOLUTION |
||
Line 196: | Line 199: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category: |
+ | [[Category:Sample Problems]] |
+ | [[Category:Subject Area Templates]] |
Latest revision as of 06:51, 18 July 2023
This problem has been replaced with a newer version of this problem
A Vector Parametric Curve in the Plane
This PG code shows how to ask students for a vector parametric curve through two points and allows them to specify the time interval.
- File location in OPL: FortLewis/Authoring/Templates/Parametric/VectorParametric1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Parametric/VectorParametric1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserVectorUtils.pl", "parserMultiAnswer.pl", ); TEXT(beginproblem()); |
Initialization:
Since it is a vector parametric curve, we will want vector utilities from |
Context("Vector2D"); #Context("Vector"); # for 3D vectors Context()->variables->are(t=>"Real"); Context()->variables->set(t=>{limits=>[0,5]}); Context()->flags->set( ijk=>0 ); $a = random(2,5,1); $Q = Point($a,$a**2); $multians = MultiAnswer(Vector("<t,t**2>"),0,$a)->with( singleResult => 1, checker => sub { my ($correct,$student,$self) = @_; # get the parameters my ($f,$x1,$x2) = @{$student}; # extract student answers if ( ( ($f . i)**2 == ($f . j) ) && ($f->eval(t=>$x1) == Vector("<0,0>")) && ($f->eval(t=>$x2) == Vector("<$a,$a**2>")) ) { return 1; } elsif ( ( ($f . i)**2 == ($f . j) ) && ($f->eval(t=>$x1) == Vector("<0,0>")) ) { $self->setMessage(3,"Your right endpoint is not correct."); return 0; } elsif ( ( ($f . i)**2 == ($f . j) ) && ($f->eval(t=>$x2) == Vector("<$a,$a**2>")) ) { $self->setMessage(2,"Your left endpoint is not correct."); return 0; } elsif ( ( ($f . i)**2 == ($f . j) ) ) { $self->setMessage(2,"Your left endpoint is not correct."); $self->setMessage(3,"Your right endpoint is not correct."); return 0; } else { return 0; } } ); |
Setup:
The student's vector-valued function is stored in |
Context()->texStrings; BEGIN_TEXT Find a vector parametric equation for the parabola \( y = x^2 \) from the origin to the point \( $Q \) using \( t \) as a parameter. $BR $BR \( \vec{r}(t) = \) \{$multians->ans_rule(20)\} for \{$multians->ans_rule(5)\} \( \leq t \leq \) \{$multians->ans_rule(5)\} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $multians->cmp() ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |