Learn R Programming

phaseR (version 2.2.1)

example2: Example ODE system 2

Description

The derivative function of an example one-dimensional autonomous ODE system.

Usage

example2(t, y, parameters)

Value

Returns a list containing the value of the derivative at (t, y).

Arguments

t

The value of t, the independent variable, to evaluate the derivative at. Should be a numeric vector of length one.

y

The value of y, the dependent variable, to evaluate the derivative at. Should be a numeric vector of length one.

parameters

The values of the parameters of the system. Not used here.

Author

Michael J Grayling

Details

example2 evaluates the derivative of the following ODE at the point (t, y):

dy/dt = y(1 - y)(2 - y).

Its format is designed to be compatible with ode from the deSolve package.

See Also

ode

Examples

Run this code
# Plot the flow field and several trajectories
example2_flowField     <- flowField(example2,
                                    xlim   = c(0, 4),
                                    ylim   = c(-1, 3),
                                    system = "one.dim",
                                    add    = FALSE,
                                    xlab   = "t")
example2_trajectory    <- trajectory(example2,
                                     y0     = c(-0.5, 0.5, 1.5, 2.5),
                                     tlim   = c(0, 4),
                                     system = "one.dim")
# Plot the phase portrait
example2_phasePortrait <- phasePortrait(example2,
                                        ylim = c(-0.5, 2.5),
                                        frac = 0.5)
# Determine the stability of the equilibrium points
example2_stability_1   <- stability(example2,
                                    ystar  = 0,
                                    system = "one.dim")
example2_stability_2   <- stability(example2,
                                    ystar  = 1,
                                    system = "one.dim")
example2_stability_3   <- stability(example2,
                                    ystar  = 2,
                                    system = "one.dim")

Run the code above in your browser using DataLab