To fix terminology, the noun ``map'' will be used for a C++ function that accepts one or more double arguments or a P argument, and returns a double or a P. Maps can be depicted in two mathematically useful ways: graphing (which retains information about the domain), and drawing the image as a parametrized curve or surface (which discards domain information). Usually, a double-valued map is graphed, while a P-valued map is viewed parametrically. The verb ``plot'' is used generically to mean either sort of depiction, and the noun ``plot'' refers to the result of plotting.
The ``domain'' of a map is the set of allowed input values. In ePiX,
a domain is a coordinate box of dimension one, two, or three.
For uniformity, a 2-dimensional domain is actually a 3-dimensional
domain whose ``thickness'' along the -axis is 0. Similarly, a
1-dimensional domain is a ``highly degenerate'' 3-dimensional domain.
Domains facilitate the plotting of families of mappings, and the
selective plotting of parts of a mapping; domain operators for
these purposes are described below.
A plot depends on a map and a domain. For example, suppose f is
a P-valued map of two (double) variables, and R
is a two-dimensional domain. To construct a plot, subdivide R
with a ``coarse'' rectangular mesh, say having
sub-rectangles. For each ``grid line'', plot
the parametric curve obtained by evaluating f along the line.
The result is the (wiremesh) plot of f over R.
A detail was omitted in the preceding paragraph: the number of points
plotted in each parametric curve. Many graphing programs use as many
points as dictated by the coarse mesh, so that the surface is made of
quadrilaterals (Figure 3.2, left). In ePiX, a domain
possesses a ``fine'' mesh, say that divides R into
subrectangles (Figure 3.2, right).
The individual parametric curves comprising
the surface are drawn using the fine subdivisions. A plot can conform
to the ``true'' surface without requiring many quadrilaterals.
A domain is defined by giving a pair of opposite corners, the coarse mesh, and the fine mesh. A domain's meshes are independent; the fine mesh need not be a ``multiple'' of the coarse mesh. Indeed, the ``fine'' mesh may be more coarse than the ``coarse'' mesh. Usually, however, the fine mesh is a ``small multiple'' of the coarse mesh.
A domain can be resized in any coordinate direction for which the thickness is positive, using object-oriented syntax. For the domain R above,
domain R_new = R.resize2(0.5,0.75);defines a new domain having opposite corners
A domain can be sliced by setting one variable to a constant; the result is a domain whose dimension is one smaller than the original:
domain R1 = R.slice1(0.3);creates the 1-dimensional domain with endpoints
plot(f, R.slice1(0.3));draws the parametric curve obtained by slicing R at
For plotting families of maps, a domain has ``slices'' operators that return the list of domain slices obtained by setting one variable to components of the coarse mesh:
When plotting a function of one variable, constructing a domain is possible but tedious. The command
plot(f, t_min, t_max, n);plots f over the interval [t_min, t_max] using n subintervals (n+1 points).
The ability to slice or resize makes domains more useful when
plotting functions of two or three variables. The commands below
typify plot commands; is a function of one variable, and
is a
function of 2 or 3 variables. If the function is real-valued, the
graph is drawn; otherwise the image is drawn.
// two ways to plot F on [a,b] x [c,d] plot(F, P(a,c), P(b,d), mesh(N1,N2), mesh(n1,n2)); domain R(P(a,c), P(b,d), mesh(N1,N2), mesh(n1,n2)); plot(F, R); plot(F, R.slice1(a)); // plot F on part of the boundary plot(F, R.slices1()); // plot F over all slices x1=constA function of 3 variables can be plotted over a 1- or 2-dimensional domain, while a function of 2 variables cannot be plotted over a 3-dimensional domain.