plot::Ode3d(f, [t0, t1,...], Y0) renders three-dimensional projections of the solutions of the initial value problem given by
plot::Ode3d(f, [t0, t1,...], Y0, [G]) computes a mesh of numerical sample points Y(t0), Y(t1), … representing the solution Y(t) of the first order differential equation (dynamical system)
maps these solution points (ti, Y(ti)) in ℝ×ℂn to a mesh of 3D plot points [xi, yi, zi]. These points can be connected by straight lines or interpolating splines.
Internally, a sequence of numerical sample points
Y_1 := numeric::odesolve(f, t_0..t_1, Y_0, Options),
Y_2 := numeric::odesolve(f, t_1..t_2, Y_1, Options), and so on
is computed, where
Options is some combination of
RelativeError = rtol,
AbsoluteError = atol, and
Stepsize = h. See
numeric::odesolve for details on the vector field procedure
f, the initial condition
Y0, and the options.
The utility function
numeric::ode2vectorfield may be used to produce the input parameters
f, t0, Y0 from a set of differential expressions representing the ODE.
Each of the "generators of plot data"
G2 etc. creates a graphical solution curve from the numerical sample points
Y1 etc. Each generator
G, say, is internally called in the form
G(t0, Y0), G(t1, Y1), … to produce a sequence of plot points in 3D.
numeric::odesolve returns the solution points
Y1, and so on, as lists or one-dimensional arrays (the actual type is determined by the initial value
Y0). Consequently, each generator
G must accept two arguments
t is a real parameter,
Y is a "vector" (either a list or a 1-dimensional array).
Each generator must return a list with 3 elements representing the (x, y, z) coordinates of the graphical point associated with a solution point
(t, Y) of the ODE. All generators must produce graphical data of the same dimension, that is, for
plot::Ode3d, 3D data as lists with 3 elements. For example,
G := (t, Y) -> [Y_1, Y_2, Y_3] creates a 3D phase plot of the first three components of the solution curve.
If no generators are given,
plot::Ode3d by default plots each group of two components as functions of time with the same style.
Note that arbitrary values associated with the solution curve may be displayed graphically by an appropriate generator
G1, G2, and so on, can be specified to generate several curves associated with the same numerical mesh
Y0, Y1, ….
The graphical data produced by each of the generators
G1, G2,... consists of a sequence of mesh points in 3D.
Style = Points, the graphical data are displayed as a discrete set of points.
Style = Lines, the graphical data points are displayed as a curve consisting of straight line segments between the sample points. The points themselves are not displayed.
Style = Splines, the graphical data points are displayed as a smooth spline curve connecting the sample points. The points themselves are not displayed.
Style = [Splines, Points] and
Style = [Lines, Points], the effects of the styles used are combined, that is, both the evaluation points and the straight lines or splines, respectively, are displayed.
The plot attributes accepted by
Submesh = n, where n is some positive integer. This attribute only has an effect on the curves which are returned for the graphical generators with
Style = Splines and
Style = [Splines, Points], respectively. It serves for smoothening the graphical spline curve using a sufficiently high number of plot points.
n is the number of plot points between two consecutive numerical points corresponding to the time mesh. The default value is n = 4, that is, the splines are plotted as five straight line segments connecting the numerical sample points.
Consider the nonlinear oscillator , . As a dynamical system for , solve the following initial value problem , Y(0) = Y0:
The following generator produces a phase plot in the (x, y) plane, embedded in a 3D plot:
Further, use the z coordinate of the 3D plot to display the value of the "energy" function over the phase curve:
The phase curve in the (x, y) plane is combined with the graph of the energy function:
Set an explicit size of the points used in the representation of the energy:
The renderer is called:
The Lorenz ODE is the system
with fixed parameters p, r, b. As a dynamical system for Y = [x, y, z], solve the ODE with the following vector field:
Consider the following parameters and the following initial condition
The following generator
Gxyz produces a 3D phase plot of the solution. The generator
Gyz projects the solution curve to the (y, z) plane with x = 20; the generator
Gxz projects the solution curve to the (x, z) plane with y = - 15; the generator
Gxy projects the solution curve to the (x, y) plane with z = 0:
With these generators, create a 3D plot object consisting of the phase curve and its projections.
Finally, the plot is rendered. This call is somewhat time consuming because it calls the numerical solver
numeric::odesolve to produce the graphical data: