Learn R Programming

phaseR (version 2.2.1)

example11: Example ODE system 11

Description

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

Usage

example11(t, y, parameters)

Value

Returns a list containing the values of the two derivatives at (t, x, 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 values of x and y, the dependent variables, to evaluate the derivative at. Should be a numeric vector of length two.

parameters

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

Author

Michael J Grayling

Details

example11 evaluates the derivatives of the following coupled ODE system at the point (t, x, y):

dx/dt = x(3 - x - 2y), dy/dt = -y(2 - x - y).

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

See Also

ode

Examples

Run this code
# Plot the velocity field, nullclines and several trajectories
example11_flowField   <- flowField(example11,
                                   xlim   = c(-5, 5),
                                   ylim   = c(-5, 5),
                                   points = 21,
                                   add    = FALSE)
y0                    <- matrix(c(4, 4, -1, -1,
                                  -2, 1, 1, -1), 4, 2,
                                byrow = TRUE)
example11_nullclines  <- nullclines(example11,
                                    xlim   = c(-5, 5),
                                    ylim   = c(-5, 5),
                                    points = 200)
example11_trajectory  <- trajectory(example11,
                                    y0   = y0,
                                    tlim = c(0, 10))
# Determine the stability of the equilibrium points
example11_stability_1 <- stability(example11, ystar = c(0, 0))
example11_stability_2 <- stability(example11, ystar = c(0, 2))
example11_stability_3 <- stability(example11, ystar = c(1, 1))
example11_stability_4 <- stability(example11, ystar = c(3, 0))

Run the code above in your browser using DataLab