@dataclass(frozen=True)
class
DuffingOscillatorParameters:
Dimensionless parameters for the stochastic Duffing oscillator SDE system.
This class contains the dimensionless parameters after conversion from physical units.
It should typically be created from PhysicalDuffingParameters via the to_dimensionless() method.
All parameters must be explicitly provided - no default values to ensure consistency.
DuffingOscillatorParameters( alpha: float, beta: float, mu: float, gamma: float, Omega: float, Theta: float, D_tilde: float, t_correl_tilde: float, timestep: float, total_time: float, initial_position: float, initial_velocity: float, initial_coloured_noise: float)
initial_coloured_noise: float
white_noise_strength: float
White noise strength: sqrt(2muTheta)
Returns:
White noise diffusion coefficient
coloured_noise_strength: float
Coloured noise driving strength: sqrt(2*D_tilde/t_correl_tilde)
Returns:
Coloured noise diffusion coefficient
equilibrium_positions: list[float]
Calculate equilibrium positions for the double-well potential.
For the Duffing potential V(q) = alphaq^2/2 + betaq^4/4:
- Double well with equilibria at q = 0 (unstable), Âħsqrt(-alpha/beta) (stable)
Returns:
List of equilibrium positions [0, -q_eq, q_eq]
potential_type: str
Return the potential type (always double-well).
Returns:
String describing potential type
@dataclass(frozen=True)
class
PhysicalDuffingParameters:
Physical parameters for the Duffing oscillator in SI units.
This is the primary parameter class that defines the system in physical units.
The dimensionless parameters are derived from these physical parameters using
characteristic length and time scales.
PhysicalDuffingParameters( mass: float = 1.0, damping_coefficient: float = 0.15, linear_stiffness: float = -1.0, nonlinear_stiffness: float = 1.0, forcing_amplitude: float = 0.4, forcing_frequency: float = 0.9, characteristic_length: Optional[float] = None, characteristic_time: Optional[float] = None, temperature: float = 300.0, boltzmann_constant: float = 1.380649e-23, coloured_noise_intensity: float = 0.04, coloured_noise_correlation_time: float = 0.5, initial_position: float = 0.1, initial_velocity: float = 0.0, timestep: float = 0.005, total_time: float = 25.0)
damping_coefficient: float =
0.15
linear_stiffness: float =
-1.0
nonlinear_stiffness: float =
1.0
forcing_amplitude: float =
0.4
forcing_frequency: float =
0.9
characteristic_length: Optional[float] =
None
characteristic_time: Optional[float] =
None
temperature: float =
300.0
boltzmann_constant: float =
1.380649e-23
coloured_noise_intensity: float =
0.04
coloured_noise_correlation_time: float =
0.5
initial_position: float =
0.1
initial_velocity: float =
0.0
@staticmethod
def
compute_characteristic_length(linear_stiffness: float, nonlinear_stiffness: float) -> float:
Compute characteristic length for double-well: lambda = sqrt(-alpha/beta)
Arguments:
- linear_stiffness: Linear stiffness coefficient (N/m) - must be negative
- nonlinear_stiffness: Nonlinear stiffness coefficient (N/m^3) - must be positive
Returns:
Characteristic length scale (m)
@staticmethod
def
compute_characteristic_time(linear_stiffness: float, mass: float) -> float:
Compute characteristic time: tau = sqrt(m / |alpha|)
Arguments:
- linear_stiffness: Linear stiffness coefficient (N/m)
- mass: Mass of the oscillator (kg)
Returns:
Characteristic time scale (s)
Create physical parameters suitable for training data generation.
Uses a timestep that gives approximately 255 time steps over the default total_time,
which provides good numerical resolution for training.
Arguments:
- noise_disabled: If True, disable all noise sources and use deterministic forcing frequency.
Returns:
PhysicalDuffingParameters configured for training.
Convert physical parameters to dimensionless form using characteristic scales.
Returns:
DuffingOscillatorParameters with dimensionless values
def
external_forcing_term( self, t: float | torch.Tensor, amplitude: float, frequency: float) -> float | torch.Tensor:
Compute the external forcing term at a given time or batch of times.
This is the dimensionless version, so t is dimensionless time.