Difference between revisions of "VectorParametricLines"
(added historical tag and gave updated problem links) |
|||
(One intermediate revision 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/VectorCalc/VectorParametricLine.html a parametric line problem], [https://openwebwork.github.io/pg-docs/sample-problems/VectorCalc/VectorLineSegment1.html a vector line segment problem] and |
||
+ | [https://openwebwork.github.io/pg-docs/sample-problems/VectorCalc/VectorLineSegment2.html another vector line segment problem] </p> |
||
<h2>Vector Parametric Lines as Answers</h2> |
<h2>Vector Parametric Lines as Answers</h2> |
||
Line 428: | Line 432: | ||
<ul> |
<ul> |
||
− | <li>POD documentation: [http://webwork.maa.org/pod/ |
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/parserParametricLine.html parserParametricLine.pl]</li> |
<li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserParametricLine.pl?view=log parserParametricLine.pl]</li> |
<li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserParametricLine.pl?view=log parserParametricLine.pl]</li> |
||
</ul> |
</ul> |
||
Line 434: | Line 438: | ||
<ul> |
<ul> |
||
<li>POD documentation: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/answerCustom.pl?view=log answerCustom.pl.html]</li> |
<li>POD documentation: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/answerCustom.pl?view=log answerCustom.pl.html]</li> |
||
− | <li>PG macro: [http://webwork.maa.org/pod/ |
+ | <li>PG macro: [http://webwork.maa.org/pod/pg/macros/answerCustom.html answerCustom.pl]</li> |
</ul> |
</ul> |
Latest revision as of 13:59, 28 June 2023
This problem has been replaced with a parametric line problem, a vector line segment problem and another vector line segment problem
Vector Parametric Lines as Answers
This shows the PG code to check student answers that are vectors whose components are formulas.
- Example 1: A vector parametric line where the student chooses the parametrization
- Example 2: A vector parametric line segment where the student chooses the parametrization and the starting and ending times
- Example 3: A vector parametric line segment where the student must enter a particular parametrization and use particular starting and ending times
Example 1: A vector parametric line where the student chooses the parametrization
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserVectorUtils.pl", "parserParametricLine.pl", "PGcourse.pl", ); TEXT(beginproblem()); |
Initialization:
The first three macros should always be loaded for questions whose answers are vector valued functions.
For the general vector parametric line we need to load |
Context("Vector"); Context()->variables->are(t=>"Real"); $P = non_zero_point3D(); $disp = non_zero_vector3D(); $Q = Point($P + $disp); |
Setup: We randomize two points in three-dimensional space, P and Q, a displacement vector between them, and a speed to travel between them. |
Context()->texStrings; BEGIN_TEXT Find a vector parametric equation for the line through points \( P = $P \) and \( Q = $Q \). $BR \( \vec{r}(t) = \) \{ ans_rule(40) \} END_TEXT Context()->normalStrings; |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ANS( ParametricLine("$P + t * $disp")->cmp() ); ENDDOCUMENT(); |
Answer Evaluation:
The answer can be any vector parametric line through the points P and Q, so we use |
Example 2: A vector parametric line segment where the student chooses the parametrization and the starting and ending times
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserVectorUtils.pl", "parserParametricLine.pl", "parserMultiAnswer.pl", "PGcourse.pl", ); TEXT(beginproblem()); |
Initialization:
The first three macros should always be loaded for questions whose answers are vector valued functions.
We need to load |
Context("Vector"); Context()->variables->are(t=>"Real"); $P = Point(4,0); $Q = Point(0,2); $V = Vector(-4,2); $t = Formula("t"); $line = Vector("$P + $t * $V"); $multians = MultiAnswer( $line, Real("0"), Real("1") )->with( singleResult => 0, checker => sub { my ( $correct, $student, $ansHash ) = @_; my ( $linestu, $astu, $bstu ) = @{$student}; my ( $linecor, $acor, $bcor ) = @{$correct}; if ( (ParametricLine("$line") == $linestu) && ($linestu->eval(t=>$astu) == $line->eval(t=>"0")) && ($linestu->eval(t=>$bstu) == $line->eval(t=>"1")) ) { return [1,1,1]; } elsif ( (ParametricLine("$line") == $linestu) && ($linestu->eval(t=>$astu) == $line->eval(t=>"0")) ) { return [1,1,0]; } elsif ( (ParametricLine("$line") == $linestu) && ($linestu->eval(t=>$bstu) == $line->eval(t=>"1")) ) { return [1,0,1]; } elsif ( (ParametricLine("$line") == $linestu) ) { return [1,0,0]; } else { return [0,0,0]; } } ); |
Setup:
We create a MutiAnswer answer checker that will evaluate the students vector parametric equation at the starting and ending times provided by the student. For example, both of the student answers |
Context()->texStrings; BEGIN_TEXT Find a vector parametric equation for the line segment from the point \(P = $P\) to \(Q = $Q\). $BR \( \vec{r}(t) = \) \{ $multians->ans_rule(40 )\} for \{ $multians->ans_rule(5) \} \( \leq t \leq \) \{ $multians->ans_rule(5) \} END_TEXT Context()->normalStrings; |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ANS( $multians->cmp() ); ENDDOCUMENT(); |
Answer Evaluation:
This part is easy since we defined |
Example 3: A vector parametric line segment where the student must enter a particular parametrization and use particular starting and ending times
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserVectorUtils.pl", "answerCustom.pl", "PGcourse.pl", ); TEXT(beginproblem()); |
Initialization:
The first three macros should always be loaded for questions whose answers are vector valued functions.
For the specific vector parametric line (part (b) in the question below) we need to load |
Context("Vector"); Context()->variables->are(t=>"Real"); $P = non_zero_point3D(); $disp = non_zero_vector3D(); $Q = Point($P + $disp); $speed = random(3,9,1); |
Setup: We randomize two points in three-dimensional space, P and Q, a displacement vector between them, and a speed to travel between them. |
Context()->texStrings; BEGIN_TEXT A particle starts at the point \( P = $P \) when \( t = 0 \) and moves along a straight line toward \( Q = $Q \) at a speed of \( $speed \) cm/sec. Assume that x, y, and z are measured in cm. Do not enter units with your answers. $BR $BR Find the vector parametric equation for the position of the object. $BR \( \vec{r}(t) = \) \{ans_rule(40)\} END_TEXT Context()->normalStrings; |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; # for checking a particular vector parametric line sub mycheck { my ($correct, $student, $ansHash) = @_; if ( ($correct . i == $student . i) && ($correct . j == $student . j) && ($correct . k == $student . k) ) { return 1; } else { return 0; } } $T = Formula("$speed * t / norm($disp)"); $r = $P + $T * $disp; ANS( custom_cmp( $r, ~~&mycheck, showCoordinateHints=>1 ) ); ENDDOCUMENT(); |
Answer Evaluation:
There is only one vector parametric equation that describes the position of the object subject to the given conditions, so we want only one answer to be marked correct. We create a custom answer checker For more on custom answer evaluators, see CustomAnswerCheckers and answerCustom.pl.html |
- POD documentation: parserParametricLine.pl
- PG macro: parserParametricLine.pl
- POD documentation: answerCustom.pl.html
- PG macro: answerCustom.pl