Difference between revisions of "VectorFieldGraph2D1"
Paultpearson (talk | contribs) m |
(add historical tag and give links to newer problems.) |
||
(2 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/VectorCalc/VectorFieldGraph2D.html a newer version of this problem]</p> |
||
+ | |||
<h2>Graphing a Vector Field in the Plane</h2> |
<h2>Graphing a Vector Field in the Plane</h2> |
||
Line 5: | Line 9: | ||
This PG code shows how to graph a vector field in the plane. |
This PG code shows how to graph a vector field in the plane. |
||
</p> |
</p> |
||
− | * Download file: [[File:VectorFieldGraph2D1.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/VectorCalc/VectorFieldGraph2D1.pg FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1.pg] |
||
− | * File location in NPL: <code>FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1.pg</code> |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1_PGML.pg FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 157: | Line 161: | ||
Context()->texStrings; |
Context()->texStrings; |
||
BEGIN_SOLUTION |
BEGIN_SOLUTION |
||
− | ${PAR}SOLUTION:${PAR} |
||
Solution explanation goes here. |
Solution explanation goes here. |
||
END_SOLUTION |
END_SOLUTION |
Latest revision as of 05:21, 18 July 2023
This problem has been replaced with a newer version of this problem
Graphing a Vector Field in the Plane
This PG code shows how to graph a vector field in the plane.
- File location in OPL: FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph2D1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGgraphmacros.pl", "VectorField2D.pl", ); TEXT(beginproblem()); $refreshCachedImages = 1; |
Initialization:
We need to include the macros file |
Context()->variables->add(y=>"Real"); # # Create a graph canvas # $gr = init_graph(-5,-5,5,5,grid=>[10,10],axes=>[0,0],pixels=>[400,400]); $gr->lb('reset'); foreach my $j (1..4) { $gr->lb( new Label(-4.7, $j, $j,'black','center','middle')); $gr->lb( new Label(-4.7, -$j,-$j,'black','center','middle')); $gr->lb( new Label( $j,-4.7, $j,'black','center','middle')); $gr->lb( new Label( -$j,-4.7,-$j,'black','center','middle')); } $gr->lb( new Label(4.7,0.2,'x','black','center','middle')); $gr->lb( new Label(0.2,4.7,'y','black','center','middle')); VectorField2D( graphobject => $gr, Fx => Formula("x/(x^2+y^2)"), Fy => Formula("y/(x^2+y^2)"), xvar => "x", yvar => "y", xmin => -5, xmax => 5, ymin => -5, ymax => 5, xsamples => 10, ysamples => 10, vectorcolor => "blue", vectorscale => 1.5, vectorthickness => 2, xavoid=>0, yavoid=>0, ); |
Setup:
We create a blank graph canvas and add labels to it. Then, using the |
Context()->texStrings; BEGIN_TEXT This is a velocity vector field for an explosion at the origin that decreases in speed the farther the distance is from the origin. $PAR $BCENTER \{ image(insertGraph($gr),width=>400,height=>400,tex_size=>700) \} $ECENTER END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |