Vector Calculus: graph of a 2D direction field
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGtikz.pl', 'PGcourse.pl');
Preamble
The macro PGtikz.pl is used to produced the direction field graph.
$graph = createTikZImage();
$graph->texPackages(['ifthen']);
$graph->BEGIN_TIKZ
\filldraw[
draw = LightBlue,
fill = white,
rounded corners = 10pt,
thick,
use as bounding box
] (-6, -6) rectangle (6, 6);
\draw[dotted] (-5, -5) grid (5, 5);
\draw[->] (-5, 0) -- (5.25, 0) node[above right] {\(x\)};
\foreach \x in {-5, ..., -1, 1, 2, ..., 5} \draw(\x, -5) node[below] {\x};
\draw[->] (0, -5) -- (0, 5.25) node[above right] {\(y\)};
\foreach \y in {-5, ..., -1, 1, 2, ..., 5} \draw(-5, \y) node[left] {\y};
\foreach \x in {-4.5, -4, ..., 4.5} {
\foreach \y in {-4.5, -4, ..., 4.5} {
\ifthenelse{\equal{\x}{0} \AND \equal{\y}{0}}{}{
\draw[thick, blue, ->]
(\x, \y) --
(
{\x + 0.4 * \y / sqrt(\x * \x + \y * \y)},
{\y - 0.4 * \x / sqrt(\x * \x + \y * \y)}
);
}
}
}
END_TIKZ
Setup
A direction field is a vector field where the length of the vectors are constant. Techniques similar to those in Two-D Vector Field are used.
The vector field <y, -x> is used and when the
vector is drawn its length is scaled by the factor
1 / sqrt(x^2 + y^2). Since this is not defined at the
origin, the ifthen package is loaded and the
\ifthenelse latex command from that package used to skip
this point.
Delete -> in the option of the \draw
command inside the \foreach loops if the arrows on the
vectors are not desired.
BEGIN_PGML
This is a direction field for [`\vec{v} = \left<y, -x\right>`].
>>[!a direction field!]{$graph}{400}<<
END_PGML
Statement
Insert the graph into the problem text using the PGML
image syntax.
Note that the alternate text given here is not sufficient to appropriately describe the image for screen reader users.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.