Functions must be defined in the preamble, before main, or in a separately compiled file, as in functions.cc. See the samples files for practical advice on usage.
plot(f, t_min, t_max, n);
Plots the graph of for input values between the limits,
using
points equally spaced in the domain. (
t_min
and
t_max
are doubles, n is an int)
adplot(f, t_min, t_max, n);
Same as plot, but attempts to space data points equidistantly along the graph. Good for dashed and dotted potting of differentiable functions whose derivative has large absolute value on small intervals, but is much slower than plot, and the output is not always more attractive.
plot(f, g, t_min, t_max, n);
Parametric plot of
, with
points. For
backward compatibility, paramplot may also be used.
polarplot(f, t_min, t_max, n);
Polar plot of for
[t_min,t_max]
, with
points. Angles are measured in revolutions;
is
a full turn.
clipplot(f, t_min, t_max, n);
clipplot(f, g, t_min, t_max, n);
Same as plot, but clips the plot to lie inside the bounding box
[x_min,x_max]
[y_min,y_max]
.
Clipping is not currently supported in polar plots, but would be an easy feature to add.
multiplot1(f1, f2, P(a,b), P(c,d), Net(n1, n2), num_pts);
If and
are functions of two variables, then
determines a mapping of the rectangle
to the plane. multiplot1 divides this
rectangle into an
grid, then plots the images of
the vertical segments (first variable held constant)
using
num_pts
points per curve. multiplot2 does
the analogous plot when the second variable is held constant. In
conjunction, these plot routines depict the image of the gridded
rectangle under the stated mapping.
plot(f1, f2, f3, t_min, t_max, n);
Draws an orthogonal perspective plot of
, with
points. If viewpoint is not set,
plot simply drops the third coordinate. See other notes on
perspective drawing above. The alternative name plot3d may be
used for backward compatibility.
The format for a data file is two floating-point numbers per line; comment lines begin with a %, and improperly formatted lines are ignored.
data_plot("filename", STYLE);
Reads data in the named file and plots the corresponding points. In addition to the marker styles listed in Table 1 above, STYLE may be PATH, which connects the dots in the named file in the order they appear.
plot_deriv(f, a, b, n);
Plots the derivative for
, computed as a symmetric
Newton quotient
tan_field(f1, f2, t_min, t_max, n);
Plots tangent vectors to the corresponding parametric
curve. Because tangents are rendered at true length, in total they
form a rough piecewise-linear approximation of the curve,
especially if
is large. The curve itself is not plotted.
plot_int(f, a, b, n);
Plots the definite integral
for
. Uses the trapezoid rule for computing a running sum; the
step size is determined by the constant ITERATIONS.
slope_field(f1, f2, P(a,b), P(c,d), n1, n2);
dart_field(f1, f2, P(a,b), P(c,d), n1, n2);
vector_field(f1, f2, P(a,b), P(c,d), n1, n2);
Graphs the slope field (fixed length, no arrows), dart field (fixed
length, small arrowheads) or vector field (true length, arrows)
on the specified rectangle, with
sample mesh. Slope lines and darts are
guaranteed not to overlap, while vectors are drawn at true length.
ode_plot(f1, f2, P(a,b), t_max, n);
Uses Euler's method to solve a system of ODEs starting at ,
attempting to follow the solution for time
in
steps. The plot terminates if it leaves the bounding box.