import sympy as sp
x, y = sp.symbols("x y")
sp.solve((sp.Eq(2 - x, 0), sp.Eq(3 - y, 0)), (x, y)){x: 2, y: 3}
A system of differential equations tracks more than one changing quantity. This is useful when variables interact, such as predators and prey, position and velocity, or two chemical concentrations.
After this lesson you should be able to:
A two-variable first-order system often looks like
dx/dt = f(x,y)
dy/dt = g(x,y)
The state is the point (x,y). As time changes, the state moves through the plane.
In a single ODE, the solution is a curve y(t). In a two-variable system, the solution is a moving point (x(t), y(t)).
A system is coupled when one variable affects the other variable’s rate of change.
Example:
x' = y
y' = -x
Here x' depends on y, and y' depends on x. Neither equation is fully independent.
An equilibrium point is a state where nothing changes. For a two-variable system, set both derivatives equal to zero:
f(x,y)=0
g(x,y)=0
Both equations must be true at the same time.
Find the equilibrium of
x' = 2 - x
y' = 3 - y
Set each derivative to zero:
2 - x = 0
3 - y = 0
Solve:
x = 2
y = 3
The equilibrium point is (2,3).
A linear homogeneous system can be written as
u' = A u
where u is a vector of variables and A is a matrix of coefficients.
For example,
x' = -2x
y' = 3y
can be written as
[x'] [-2 0][x]
[y'] = [ 0 3][y]
The x component decays while the y component grows.
At each point (x,y), the system gives a vector (x',y'). A phase plane draws many of these vectors. A trajectory follows the arrows.
Consider
x' = y
y' = -x
At (1,0), the derivative vector is (0,-1), so the state moves downward. At (0,-1), the derivative vector is (-1,0), so the state moves left. This pattern produces rotation around the origin.
(x,y) with a graph of y versus x.Is x'=x+y, y'=y coupled? Explain.
Find the equilibrium of x'=5-x, y'=-2-y.
Write x'=2x+y, y'=3x-y in matrix form.
At the point (1,2), what is the vector for x'=y, y'=-x?
x' depends on y.x=5, y=-2, so the equilibrium is (5,-2).u' = A u with A = [[2,1],[3,-1]].(x',y')=(2,-1).For systems, every state has a vector of rates. Learn to read the vector before trying to solve formulas.
Guess first. In x' = y, y' = -x, does each variable influence the other?
Guided exercise.
x' = y the rate of x depends on y
y' = -x the rate of y depends on x
The system is coupled because the variables appear in each other’s derivative rules.
Checkpoint. Decide whether x' = 2x, y' = -3y is coupled. Then decide whether x' = x + y, y' = y is coupled.
Guess first. For x' = 4 - 2x, y' = y + 1, where might motion stop?
Guided exercise.
Set both derivatives equal to zero:
4 - 2x = 0
-2x = -4
x = 2
and
y + 1 = 0
y = -1
The equilibrium point is (2, -1).
Checkpoint. Find the equilibrium of x' = 3 - x + y, y' = x - 1. Solve the two equations carefully.
Guess first. For x' = y, y' = -x, what direction should the vector at (0, 2) point?
Guided exercise.
x' = y = 2
y' = -x = 0
The vector is (2, 0), so it points to the right.
Checkpoint. For x' = x - y, y' = x + y, find the vector at (1, -2).
Guess first. In u' = Au, what does the matrix do?
Guided exercise.
For
x' = -2x
y' = 3y
the matrix is diagonal:
A = [-2 0]
[ 0 3]
The x component decays because its coefficient is negative. The y component grows because its coefficient is positive. Different directions have different behaviors, which is the beginning of phase-plane analysis.
Checkpoint. Write the matrix for x' = x + 2y, y' = -3x + y. Which entries show coupling?
Use SymPy to find equilibrium points by solving simultaneous equations.
{x: 2, y: 3}
Use edumath to approximate a simple system numerically.
[(0, (1.0, 0.0)),
(0.1, (1.0, -0.1)),
(0.2, (0.99, -0.2)),
(0.30000000000000004, (0.97, -0.29900000000000004)),
(0.4, (0.9400999999999999, -0.396)),
(0.5, (0.9005, -0.49001))]