Search Knowledge

© 2026 LIBREUNI PROJECT

Calculus & Analysis / Overview

Systems of ODEs

Systems of ODEs

Many physical systems involve multiple variables that change simultaneously, leading to coupled systems of differential equations.

Linear Systems with Constant Coefficients

A first-order linear system has the form: x(t)=Ax(t)\mathbf{x}'(t) = \mathbf{A}\mathbf{x}(t) where A\mathbf{A} is a constant matrix. If A\mathbf{A} has eigenvalues λi\lambda_i and eigenvectors vi\mathbf{v}_i, the general solution is: x(t)=cieλitvi\mathbf{x}(t) = \sum c_i e^{\lambda_i t} \mathbf{v}_i

python
1import numpy as np
2 
3# System: dx/dt = x + y, dy/dt = 4x + y
4A = np.array([[1, 1], [4, 1]])
5 
6eigenvalues, eigenvectors = np.linalg.eig(A)
7 
8print("Eigenvalues:", eigenvalues)
9print("Eigenvectors:\n", eigenvectors)
10 
11# Solution components involve exp(3t) and exp(-t)

Phase Plane Analysis

The behavior of the system near equilibrium points (where x=0\mathbf{x}' = 0) can be classified by the eigenvalues:

  • Sink (Stable node): All eigenvalues real and negative.
  • Source (Unstable node): All eigenvalues real and positive.
  • Saddle Point: Real eigenvalues of opposite signs.
  • Center: Purely imaginary eigenvalues.
  • Spiral: Complex eigenvalues with non-zero real part.

If the eigenvalues of a 2x2 system are -2 and -5, what is the stability of the origin?

Numerical Integration (Runge-Kutta)

For non-linear systems or those without analytical solutions, we use numerical methods like the 4th-order Runge-Kutta (RK4).

python
1def rk4_step(f, x, dt):
2 k1 = f(x)
3 k2 = f(x + 0.5 * dt * k1)
4 k3 = f(x + 0.5 * dt * k2)
5 k4 = f(x + dt * k3)
6 return x + (dt / 6.0) * (k1 + 2*k2 + 2*k3 + k4)
7 
8# Predator-Prey (Lotka-Volterra)
9def lotka_volterra(state):
10 x, y = state
11 a, b, c, d = 1.0, 0.1, 1.5, 0.75
12 return np.array([a*x - b*x*y, -c*y + d*x*y])
13 
14state = np.array([10.0, 5.0]) # Initial populations
15dt = 0.1
16for _ in range(5):
17 state = rk4_step(lotka_volterra, state, dt)
18 print(f"Populations: {state}")

What is a limit cycle in the context of phase plane analysis?