# For a two variable system of differential equations we use the
# formula notation for dx/dt and the dy/dt separately:
system_eq <- c(dx ~ cos(y),
dy ~ sin(x))
phaseplane(system_eq,x_var='x',y_var='y')
# For a one dimensional system: dy/dt = f(t,y). In this case the
# xWindow represents time.
# However, the code is structured a little differently.
# Consider dy/dt = -y*(1-y):
system_eq <- c(dt ~ 1,
dy ~ -y*(1-y))
phaseplane(system_eq,x_var="t",y_var="y")
# \donttest{
# Here is an example to find equilibrium solutions.
system_eq <- c(dx ~ y+x,
dy ~ x-y)
phaseplane(system_eq,x_var='x',y_var='y',eq_soln=TRUE)
# We would expect an equilibrium at the origin,
# but no equilibrium solution was found, but if we narrow the search range:
phaseplane(system_eq,x_var='x',y_var='y',x_window = c(-0.1,0.1),y_window=c(-0.1,0.1),eq_soln=TRUE)
# Confirm any equilibrium solutions through direct evaluation of the differential equation.
# }
Run the code above in your browser using DataLab