| name | dynamical-systems |
| description | Analyze nonlinear dynamical systems — phase portraits, fixed points, stability analysis, bifurcation diagrams, Poincare sections, Lyapunov exponents, and chaos detection. Use for any autonomous or non-autonomous ODE system where qualitative behavior matters. |
| category | physics |
| version | 1.0.0 |
| author | Synthetic Sciences |
| license | MIT |
| tags | ["Dynamical Systems","Phase Portrait","Bifurcation","Chaos","Lyapunov","Stability","Nonlinear"] |
| dependencies | ["scipy>=1.11.0","numpy>=1.24.0","matplotlib>=3.7.0"] |
Dynamical Systems Analysis
Overview
Qualitative and quantitative analysis of nonlinear dynamical systems. Phase portraits, fixed point classification, stability analysis, bifurcation diagrams, Poincare sections, and Lyapunov exponent computation.
When to Use
- Visualizing flow in phase space (2D and 3D systems)
- Finding and classifying fixed points (stable/unstable nodes, spirals, saddles, centers)
- Bifurcation analysis (how qualitative behavior changes with parameters)
- Detecting chaos (Lyapunov exponents, sensitivity to initial conditions)
- Poincare sections for periodicity analysis
- Limit cycle detection and characterization
Core Workflows
1. Phase Portrait (2D System)
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
def system(t, y, mu=1.0):
"""Van der Pol oscillator"""
x, v = y
return [v, mu * (1 - x**2) * v - x]
x_range = np.linspace(-4, 4, 20)
v_range = np.linspace(-6, 6, 20)
X, V = np.meshgrid(x_range, v_range)
U = V
W = 1.0 * (1 - X**2) * V - X
fig, ax = plt.subplots(figsize=(10, 8))
ax.streamplot(X, V, U, W, density=1.5, color='gray', linewidth=0.5, arrowsize=1)
colors = plt.cm.viridis(np.linspace(0, 1, 6))
i, ic ([[, ], [, ], [, ], [-, -], [, -], [, ]]):
sol = solve_ivp(system, (, ), ic, t_eval=np.linspace(, , ),
rtol=, atol=)
ax.plot(sol.y[], sol.y[], color=colors[i], linewidth=)
ax.plot(ic[], ic[], , color=colors[i], markersize=)
ax.plot(, , , markersize=, markeredgewidth=, label=)
ax.set_xlabel(, fontsize=)
ax.set_ylabel(, fontsize=)
ax.set_title(, fontsize=)
ax.legend(fontsize=)
ax.grid(, alpha=)
plt.savefig(, dpi=, bbox_inches=)