Nonlinear Oscillator Simulator
Nonlinear Oscillator Simulator simulates the motion of a Duffing oscillator, computing displacement and velocity over time with plots.
Nonlinear Oscillator (Duffing) Overview
The Duffing oscillator is a nonlinear oscillator with a cubic restoring force, described by the differential equation:
Duffing Equation: \\( m \frac{d^2x}{dt^2} + c \frac{dx}{dt} + k x + \alpha x^3 = 0 \\)
Where:
- \\(m\\): Mass (kg)
- \\(c\\): Damping coefficient (N·s/m)
- \\(k\\): Linear spring constant (N/m)
- \\(\alpha\\): Nonlinear coefficient (N/m³)
- \\(x\\): Displacement (m)
- \\(t\\): Time (s)
The equation is solved numerically using the Runge-Kutta 4th order method (RK4).
Example Simulations
Example 1: Weak Nonlinearity
\\(m = 1 \, \text{kg}\\), \\(k = 1 \, \text{N/m}\\), \\(\alpha = 0.1 \, \text{N/m}^3\\), \\(c = 0.1 \, \text{N·s/m}\\), \\(x_0 = 1 \, \text{m}\\), \\(v_0 = 0 \, \text{m/s}\\)
Simulates damped oscillations with slight nonlinear effects.
Example 2: Strong Nonlinearity
\\(m = 1 \, \text{kg}\\), \\(k = 1 \, \text{N/m}\\), \\(\alpha = 1 \, \text{N/m}^3\\), \\(c = 0.2 \, \text{N·s/m}\\), \\(x_0 = 1 \, \text{m}\\), \\(v_0 = 0 \, \text{m/s}\\)
Shows pronounced nonlinear behavior in phase space.
Example 3: Undamped Nonlinear
\\(m = 1 \, \text{kg}\\), \\(k = 1 \, \text{N/m}\\), \\(\alpha = 0.5 \, \text{N/m}^3\\), \\(c = 0 \, \text{N·s/m}\\), \\(x_0 = 0.5 \, \text{m}\\), \\(v_0 = 1 \, \text{m/s}\\)
Exhibits persistent nonlinear oscillations.
Example 4: Highly Damped
\\(m = 1 \, \text{kg}\\), \\(k = 1 \, \text{N/m}\\), \\(\alpha = 0.1 \, \text{N/m}^3\\), \\(c = 0.5 \, \text{N·s/m}\\), \\(x_0 = 1 \, \text{m}\\), \\(v_0 = 0 \, \text{m/s}\\)
Rapid decay of oscillations due to high damping.