 fieldplot - Maple Help

Home : Support : Online Help : Graphics : 2-D : fieldplot

plots

 fieldplot
 plot a 2-D vector field Calling Sequence fieldplot(f, x=r1, y=r2, options) fieldplot(f, r1, r2, options) Parameters

 f - Vector field to be plotted x - first coordinate r1 - range of first coordinate y - second coordinate r2 - range of second coordinate options - options that control the behavior of fieldplot Description

 • A typical call to the fieldplot function is fieldplot(f, x=a..b, y=c..d), where f is a list of two expressions in x and y. a..b and c..d specifies the horizontal and vertical ranges of the field. The result is a two-dimensional vector field with the vector evaluated at (x, y) located at this point.
 • It is possible to input procedures, rather than expressions, as the components of a vector field. A typical call in this case is fieldplot(f, a..b, c..d), where f is a list of two procedures in two variables.
 • It is also possible to input a 2 dimensional VectorField from the VectorCalculus package to be plotted, which works with either calling sequence as the coordinates are given as part of the field vector.
 • A call to fieldplot produces a PLOT data structure, which is then printed.  For information on these data structures, see plot/structure.
 Remaining arguments are interpreted as options which are specified as equations of the form option = value. In particular, the following optional arguments are available:
 • arrows=value
 The arrows option allows you to specify the style of arrow used to represent a vector. The possible values are line, small (or thin), medium (or slim), and large (or thick), with thin being the default.
 • grid=[value1,value2]
 The grid option allows you to set the size of the two-dimensional grid use to plot the field vectors. The default is [20,20].
 • fieldstrength=value
 The fieldstrength option allows finer control of how the size of the drawn vectors corresponds to the strength of the field. value can be any of the following:
 maximal or maximal(v): The size of the arrow corresponds to the ratio of the field strength at the given point to the maximal field strength at all points in the grid. The value v (by default $1$) is a scaling factor used to adjust the ratio. Values smaller than $1$ reduce the size of all arrows, while values larger than $1$ increase the size of all arrows. Note: In cases where $1, the drawing of arrows that are larger than the maximum size is controlled through the clipping option (see below).
 average or average(v): The size of the arrow corresponds to the ratio of the field strength at the given point to the average field strength at all points in the grid. The value v (by default $\frac{1}{2}$) multiplies the computed average to determine the maximum arrow size. The drawing of arrows that are larger than the maximum size is controlled through the clipping option (see below). This option is most useful for fields that have large regions with small values, as it allows scaling up to view the field direction for those regions.
 fixed or fixed(v): The size of all arrows is fixed to v (by default $0.9$) times the maximum arrow size for the grid. The value v must be a positive value no larger than $1$. Use of this option results in a direction plot for the field.
 log or log[v]: The size of the arrows is rescaled according to the formula size = exp(ln(strength/max)/(1+v)) where strength is the strength of the field at the point, and max is the maximum strength of the field on the grid. The value v (by default $2$) must be larger than $-1$. Values of v larger than zero have the effect of reducing the variation of the arrow length throughout the field, while values smaller than zero increase the variation. Using the value $v=0$ produces an identical plot to the default maximal plot. This option is most useful for fields that have either very large or very small variations, for example, an inverse square law (see the examples below).
 scaleto(v): The size of the arrows is scaled so that the maximum fieldstrength is assumed to be v (which must be a positive numeric value). This option is most useful when constructing an animation of fieldplots where the maximal field strength is not consistent between frames of the animation, but the relative field strength between the frames is relevant.
 • clipping=true or false
 The clipping boolean option specifies how to draw arrows that have too large a magnitude. If set to true, arrows with too large a magnitude are drawn at a fixed maximum size without an arrow head. If set to false, arrows size is not bounded, so the arrows are drawn as dictated by their magnitude, even when these arrows would obscure other arrows in the plot. By default, this option is false if a coordinate transform is applied (via the coords argument), and true otherwise. This option is only useful if the fieldstrength option is used to increase the size of the arrows, or the field has been transformed. These are the only cases in which arrows may exceed the desired length.
 • anchor=midpoint or head or tail
 The anchor keyword option specifies whether arrows should be drawn on a grid centered at their midpoint (the default), from their tail or from their head. This option can be used to change the default of centering the arrows to lining them up by either their tails or the tips of their heads.
 • Use with Coordinate Transforms
 Some discussion of the behavior of fieldplot when used in combination with the coords options is required.
 Under a coordinate transform, both the field and the location of the arrows are adjusted. Options like view and axes labels apply only to the plot after the transform has been applied.
 A significant issue arises when scaling the arrows that describe the vector field after the transform has been applied. Specifically, the transform may map many points on the grid to nearly the same area in the transformed region. The fieldplot command uses an averaging technique to determine a suitable rescaling of the field vectors after the transform. In some cases, this may not be what is desired, so the fieldstrength and clipping options can be used to adjust the plot.
 In addition, arrows that are located at transform singularities are not drawn if they have a component in a direction that becomes undefined at the singularity. As an example, a purely radial field will always have arrows drawn in polar coordinates, but the field $\left[0,1\right]$ will have no arrows drawn at $r=0$.
 • The remaining options are the same as those available for the plot command. For more information, see plot/options.
 • The command with(plots,fieldplot) allows the use of the abbreviated form of this command. Examples

 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{fieldplot}\left(\left[\frac{x}{{\left({x}^{2}+{y}^{2}+4\right)}^{\frac{1}{2}}},-\frac{y}{{\left({x}^{2}+{y}^{2}+4\right)}^{\frac{1}{2}}}\right],x=-2..2,y=-2..2\right)$ > $\mathrm{fieldplot}\left(\left[y,-\mathrm{sin}\left(x\right)-\frac{y}{10}\right],x=-10..10,y=-10..10,\mathrm{arrows}=\mathrm{SLIM},\mathrm{color}=x\right)$ The following example gives the same results as above

 > $f≔\left(x,y\right)↦y:$$g≔\left(x,y\right)↦-\mathrm{sin}\left(x\right)-\frac{y}{10}:$
 > $\mathrm{fieldplot}\left(\left[f,g\right],-10..10,-10..10,\mathrm{arrows}=\mathrm{SLIM}\right)$ An inverse square law without fieldstrength adjustment

 > $\mathrm{fieldplot}\left(\left[\frac{x}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}},\frac{y}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}}\right],x=-1..1,y=-1..1\right)$ where we note that only the arrows very close to (0,0) are visible. Now using fieldstrength=log

 > $\mathrm{fieldplot}\left(\left[\frac{x}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}},\frac{y}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}}\right],x=-1..1,y=-1..1,\mathrm{fieldstrength}=\mathrm{log}\right)$ which makes the direction of the arrows much more visible. Alternatively a pure direction plot can be produced:

 > $\mathrm{fieldplot}\left(\left[\frac{x}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}},\frac{y}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{3}{2}}}\right],x=-1..1,y=-1..1,\mathrm{fieldstrength}=\mathrm{fixed}\right)$ A radial field in polar coordinates

 > $\mathrm{fieldplot}\left(\left[r,0\right],r=0..1,t=0..\frac{\mathrm{\pi }}{2},\mathrm{coords}=\mathrm{polar}\right)$ A field in polar coordinates that will not draw the arrows at the origin (the field direction is undefined there).

 > $\mathrm{fieldplot}\left(\left[0,1\right],r=0..1,t=0..\frac{\mathrm{\pi }}{2},\mathrm{coords}=\mathrm{polar}\right)$ The command to create the plot from the Plotting Guide is

 > $f≔\left(x,y\right)↦\frac{x}{\sqrt{{x}^{2}+{y}^{2}+4}}:$$g≔\left(x,y\right)↦-\frac{y}{\sqrt{{x}^{2}+{y}^{2}+4}}:$
 > $\mathrm{fieldplot}\left(\left[f,g\right],-2..2,-2..2,\mathrm{arrows}=\mathrm{SLIM},\mathrm{grid}=\left[7,7\right]\right)$ 