Vector Calculus: graph of a 3D vector field
Download file: VectorFieldGraph3D1.pg
DOCUMENT();
loadMacros(
'PGstandard.pl', 'PGML.pl',
'LiveGraphicsVectorField3D.pl', 'PGcourse.pl'
);
Preamble
Include the LiveGraphicsVectorField3D.pl
macro. Note that the LiveGraphics3D.pl
macro is loaded by that macro and provides the Live3Ddata
method.
Context()->variables->are(x => 'Real', y => 'Real', z => 'Real');
$plot = VectorField3D(
Fx => Formula('x'),
Fy => Formula('y'),
Fz => Formula('z'),
xvar => 'x',
yvar => 'y',
zvar => 'z',
xmin => -1,
xmax => 1,
ymin => -1,
ymax => 1,
zmin => -1,
zmax => 1,
xsamples => 4,
ysamples => 4,
zsamples => 4,
axesframed => 1,
xaxislabel => 'X',
yaxislabel => 'Y',
zaxislabel => 'Z',
vectorcolor => 'RGBColor[0.0, 0.0, 1.0]',
vectorscale => 0.2,
vectorthickness => 0.01,
outputtype => 4,
);
Setup
The VectorField3D method returns a string of plot data
suitable for use with the Live3Ddata method consisting of a
list of line segments (the vectors) along with other plot options. The
arguments a, b, and c in
RGBColor[a, b, c] are numbers from 0 to 1. You can
uniformly scale all of the vectors in the vector field by the same
amount using vectorscale.
The outputtype feature controls how much of the string
of plot data is generated. Setting it equal to 4 generates all of the
plot information necessary to generate a single graph. Setting
outputtype to something other than 4 is used to combine
output from multiple live graphics 3D methods into a single graph.
See LiveGraphicsVectorField3D.pl for more details.
BEGIN_PGML
The following is the 3D vector field given by
>> [``\vec{v} = \left<x, y, z\right>``] <<
>> [@ Live3Ddata(
$plot,
image => alias('exploding-vector-field.png'),
size => [ 400, 400 ],
tex_size => 600,
tex_center => 1,
scale => 1.25,
) @]* <<
END_PGML
Statement
Show the plot.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.