config – Configuration

Configuration module for DifferentialLab.

config.get_current_env_values()[source]

Collect current environment values as strings for all schema keys.

Uses validated cache when populated for performance.

Return type:

dict[str, str]

Returns:

Dictionary mapping each schema key to its string value.

config.get_env(key, default, cast_type=<class 'str'>)[source]

Get environment variable with type casting, validation, and fallback.

Parameters:
  • key (str) – Environment variable name.

  • default (Any) – Default value if variable not found or invalid.

  • cast_type (Type[Union[str, int, float, bool]]) – Type to cast the value to.

Return type:

Union[str, int, float, bool]

Returns:

The validated value, or default if missing/invalid.

config.get_env_from_schema(key)[source]

Get environment variable using ENV_SCHEMA defaults.

Uses validated cache when available (after startup) for performance.

Parameters:

key (str) – Environment variable name (must exist in ENV_SCHEMA).

Return type:

Any

Returns:

The validated value.

Raises:

KeyError – If key is not in ENV_SCHEMA.

config.initialize_and_validate_config()[source]

Initialize and validate all configuration values at startup.

Invalid values are silently corrected to defaults with a log warning.

Return type:

None

config.write_env_file(env_path, values)[source]

Write a .env file with the given key=value pairs.

Parameters:
  • env_path (Path) – Destination path for the .env file.

  • values (dict[str, str]) – Mapping from environment keys to string values.

Return type:

None

config.generate_output_basename(prefix='solution')[source]

Generate a timestamped base filename.

Parameters:

prefix (str) – Filename prefix.

Return type:

str

Returns:

String like solution_20260218_143022.

config.get_csv_path(basename)[source]

Return the full path for a CSV file.

Parameters:

basename (str) – Base filename (without extension).

Return type:

Path

Returns:

Full path with .csv extension.

config.get_env_path()[source]

Return the path to the .env file.

Return type:

Path

Returns:

Absolute path to .env in the project root.

config.get_output_dir()[source]

Return the absolute output directory, creating it if needed.

Return type:

Path

Returns:

Path to the output directory (always output/ from project root).

config.get_project_root()[source]

Return the absolute project root directory.

Return type:

Path

Returns:

Path to the project root (parent of src/).

config.constants

Application constants for DifferentialLab.

config.env

Environment variable loading, schema definition, and validation.

config.env.get_env(key, default, cast_type=<class 'str'>)[source]

Get environment variable with type casting, validation, and fallback.

Parameters:
  • key (str) – Environment variable name.

  • default (Any) – Default value if variable not found or invalid.

  • cast_type (Type[Union[str, int, float, bool]]) – Type to cast the value to.

Return type:

Union[str, int, float, bool]

Returns:

The validated value, or default if missing/invalid.

config.env.get_env_from_schema(key)[source]

Get environment variable using ENV_SCHEMA defaults.

Uses validated cache when available (after startup) for performance.

Parameters:

key (str) – Environment variable name (must exist in ENV_SCHEMA).

Return type:

Any

Returns:

The validated value.

Raises:

KeyError – If key is not in ENV_SCHEMA.

config.env.get_current_env_values()[source]

Collect current environment values as strings for all schema keys.

Uses validated cache when populated for performance.

Return type:

dict[str, str]

Returns:

Dictionary mapping each schema key to its string value.

config.env.write_env_file(env_path, values)[source]

Write a .env file with the given key=value pairs.

Parameters:
  • env_path (Path) – Destination path for the .env file.

  • values (dict[str, str]) – Mapping from environment keys to string values.

Return type:

None

config.env.initialize_and_validate_config()[source]

Initialize and validate all configuration values at startup.

Invalid values are silently corrected to defaults with a log warning.

Return type:

None

config.paths

File path management for output files.

config.paths.get_project_root()[source]

Return the absolute project root directory.

Return type:

Path

Returns:

Path to the project root (parent of src/).

config.paths.get_output_dir()[source]

Return the absolute output directory, creating it if needed.

Return type:

Path

Returns:

Path to the output directory (always output/ from project root).

config.paths.generate_output_basename(prefix='solution')[source]

Generate a timestamped base filename.

Parameters:

prefix (str) – Filename prefix.

Return type:

str

Returns:

String like solution_20260218_143022.

config.paths.get_csv_path(basename)[source]

Return the full path for a CSV file.

Parameters:

basename (str) – Base filename (without extension).

Return type:

Path

Returns:

Full path with .csv extension.

config.paths.get_env_path()[source]

Return the path to the .env file.

Return type:

Path

Returns:

Absolute path to .env in the project root.

config.equations

ODE functions for complex differential equations defined in code.

Functions here are callable as f(x, y, **params) and return dy/dx as a 1-D numpy array. They can be referenced from config/equations/*.yaml via function_name.

config.equations.schrodinger_equation(x, y, a=1.0, b=0.5, hamiltonian_function=None, potential_function=None, **kwargs)[source]

Time-dependent Schrödinger equation: iℏ ∂ψ/∂t = Ĥ(t)ψ.

Uses Hamiltonian H(x) and potential V(x) as functions of time x. y = [Re(ψ), Im(ψ)] for a single-component wave function.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [Re(ψ), Im(ψ)].

  • a (float) – Hamiltonian scale parameter.

  • b (float) – Potential scale parameter.

  • hamiltonian_function (Any) – Custom H(x, a). If None, uses default.

  • potential_function (Any) – Custom V(x, b). If None, uses default.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.lorentz_system(x, y, sigma=10.0, rho=28.0, beta=2.6666666666666665, **kwargs)[source]

Lorenz system: chaotic attractor.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • sigma (float) – Prandtl number.

  • rho (float) – Rayleigh number.

  • beta (float) – Geometric factor.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.duffing_oscillator(x, y, delta=0.5, alpha=-1.0, beta=1.0, gamma=0.3, omega=1.2, **kwargs)[source]

Duffing oscillator: y’’ + δy’ + αy + βy³ = γcos(ωt).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y, y'].

  • delta (float) – Damping.

  • alpha (float) – Linear stiffness.

  • beta (float) – Cubic stiffness.

  • gamma (float) – Forcing amplitude.

  • omega (float) – Forcing frequency.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.lotka_volterra(x, y, alpha=1.0, beta=0.1, gamma=1.5, delta=0.075, **kwargs)[source]

Lotka-Volterra predator-prey: dx/dt = αx - βxy, dy/dt = δxy - γy.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [x, y] (prey, predator).

  • alpha (float) – Prey growth rate.

  • beta (float) – Predation rate.

  • gamma (float) – Predator death rate.

  • delta (float) – Predator growth from prey.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rigid_body_euler(x, y, I1=1.0, I2=2.0, I3=3.0, **kwargs)[source]

Euler equations for rigid body: dω/dt = I⁻¹(τ - ω×(Iω)). No torque.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [ω₁, ω₂, ω₃] (angular velocities).

  • I1 (float) – Principal moment of inertia 1.

  • I2 (float) – Principal moment of inertia 2.

  • I3 (float) – Principal moment of inertia 3.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rlc_circuit(x, y, R=1.0, L=1.0, C=1.0, **kwargs)[source]

y’’ + (R/L)y’ + (1/LC)y = 0 — RLC series circuit (zero forcing).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [q, q'] (charge, current).

  • R (float) – Resistance.

  • L (float) – Inductance.

  • C (float) – Capacitance.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.gompertz_growth(x, y, r=0.5, K=10.0, **kwargs)[source]

y’ = ry·ln(K/y) — Gompertz growth (tumor, cell populations).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.newton_cooling(x, y, k=0.1, T_env=20.0, **kwargs)[source]

y’ = -k(y - T_env) — Newton’s law of cooling.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [T] (temperature).

  • k (float) – Cooling coefficient.

  • T_env (float) – Ambient temperature.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.linear_decay_source(x, y, a=1.0, b=0.5, **kwargs)[source]

y’ = a - by — Linear decay with constant source (e.g. drug concentration).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y].

  • a (float) – Source/inflow rate.

  • b (float) – Decay rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.airy_equation(x, y, **kwargs)[source]

y’’ = x·y — Airy equation (quantum mechanics, optics).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.hermite_ode(x, y, n=2.0, **kwargs)[source]

y’’ - 2xy’ + 2ny = 0 — Hermite equation (QHO eigenfunctions).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • n (float) – Quantum number / eigenvalue parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.laguerre_ode(x, y, n=1.0, **kwargs)[source]

xy’’ + (1-x)y’ + ny = 0 — Laguerre equation (hydrogen radial).

Parameters:
  • x (float) – Independent variable (r).

  • y (ndarray) – State vector [y, y'].

  • n (float) – Parameter (integer for Laguerre polynomials).

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.bessel_ode(x, y, n=0.0, **kwargs)[source]

y’’ + y’/x + (1 - n²/x²)y = 0 — Bessel equation (radial QM).

Parameters:
  • x (float) – Independent variable (x > 0).

  • y (ndarray) – State vector [y, y'].

  • n (float) – Order (integer for Bessel functions).

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.stationary_schrodinger_ho(x, y, E=1.5, **kwargs)[source]

y’’ + (E - x²)y = 0 — 1D Schrödinger in harmonic well (ℏ=m=ω=1).

Parameters:
  • x (float) – Position.

  • y (ndarray) – State vector [ψ, ψ'] (wave function).

  • E (float) – Energy eigenvalue.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.stationary_schrodinger_well(x, y, E=2.0, V0=10.0, a=1.0, **kwargs)[source]

y’’ + (E - V(x))y = 0 — 1D Schrödinger, finite square well.

V(x) = V0 for |x| > a, 0 otherwise. Units ℏ²/(2m)=1.

Parameters:
  • x (float) – Position.

  • y (ndarray) – State vector [ψ, ψ'] (wave function).

  • E (float) – Energy eigenvalue.

  • V0 (float) – Well depth.

  • a (float) – Half-width of the well.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.kummer_ode(x, y, a=1.0, b=1.0, **kwargs)[source]

xy’’ + (b-x)y’ - ay = 0 — Kummer (confluent hypergeometric); hydrogen.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • a (float) – Kummer parameter a.

  • b (float) – Kummer parameter b.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rabi_oscillations(x, y, Omega=1.0, delta=0.0, omega_drive=1.0, **kwargs)[source]

Rabi oscillations: two-level system. y = [Re(c_g), Im(c_g), Re(c_e), Im(c_e)].

dc_g/dt = -i(Ω/2)cos(ωt)c_e, dc_e/dt = -i(Ω/2)cos(ωt)c_g - iΔ·c_e.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [Re(c_g), Im(c_g), Re(c_e), Im(c_e)].

  • Omega (float) – Rabi frequency.

  • delta (float) – Detuning.

  • omega_drive (float) – Drive frequency.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.bloch_equations(x, y, gamma=1.0, Bx=0.0, By=0.0, Bz=1.0, T1=1000000.0, T2=1000000.0, **kwargs)[source]

Bloch equations for magnetization: dM/dt = γ(M×B) - relaxation.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [Mx, My, Mz].

  • gamma (float) – Gyromagnetic ratio.

  • Bx (float) – Magnetic field x-component.

  • By (float) – Magnetic field y-component.

  • Bz (float) – Magnetic field z-component.

  • T1 (float) – Longitudinal relaxation time.

  • T2 (float) – Transverse relaxation time.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rossler_attractor(x, y, a=0.2, b=0.2, c=5.7, **kwargs)[source]

Rössler attractor: chaotic system.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.sir_epidemic(x, y, beta=0.5, gamma=0.2, **kwargs)[source]

SIR epidemic model: dS/dt = -βSI, dI/dt = βSI - γI, dR/dt = γI.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [S, I, R] (susceptible, infected, recovered).

  • beta (float) – Transmission rate.

  • gamma (float) – Recovery rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.fitzhugh_nagumo(x, y, a=0.7, b=0.8, I_ext=0.0, **kwargs)[source]

FitzHugh-Nagumo neuron model: simplified Hodgkin-Huxley.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [v, w] (membrane potential, recovery variable).

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • I_ext (float) – External current.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.chen_system(x, y, a=35.0, b=3.0, c=28.0, **kwargs)[source]

Chen system: chaotic attractor (dual to Lorenz).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.brusselator(x, y, A=1.0, B=3.0, **kwargs)[source]

Brusselator: autocatalytic chemical reaction (limit cycle).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [u, v] (concentrations).

  • A (float) – Parameter A.

  • B (float) – Parameter B.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.michaelis_menten(x, y, V_max=1.0, K_m=0.5, **kwargs)[source]

y’ = -V_max·y/(K_m + y) — Michaelis-Menten enzyme kinetics.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [S] (substrate concentration).

  • V_max (float) – Maximum reaction rate.

  • K_m (float) – Michaelis constant.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.riccati_ode(x, y, a=1.0, b=0.5, c=-0.1, **kwargs)[source]

y’ = a + b·y + c·y² — Riccati equation (general form).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • a (float) – Constant term.

  • b (float) – Linear coefficient.

  • c (float) – Quadratic coefficient.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rayleigh_oscillator(x, y, mu=1.0, **kwargs)[source]

y’’ - μ(1 - y’²)y’ + y = 0 — Rayleigh oscillator (self-excited).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y, y'].

  • mu (float) – Nonlinearity parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.forced_harmonic_oscillator(x, y, omega=1.0, F=0.5, Omega=1.2, **kwargs)[source]

y’’ + ω²y = F·cos(Ωt) — Forced harmonic oscillator.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y, y'].

  • omega (float) – Natural frequency.

  • F (float) – Forcing amplitude.

  • Omega (float) – Forcing frequency.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.allee_effect(x, y, r=1.0, K=10.0, m=0.2, **kwargs)[source]

y’ = ry(1 - y/K)(y/K - m) — Allee effect (critical threshold).

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • m (float) – Allee threshold (0 < m < 1).

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.langmuir_adsorption(x, y, k_a=1.0, k_d=0.2, **kwargs)[source]

y’ = k_a(1 - y) - k_d·y — Langmuir adsorption/desorption.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [θ] (surface coverage 0–1).

  • k_a (float) – Adsorption rate.

  • k_d (float) – Desorption rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.thomas_attractor(x, y, b=0.208186, **kwargs)[source]

Thomas’ cyclically symmetric attractor: chaotic 3D system.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • b (float) – Parameter (typically ~0.2).

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.hindmarsh_rose(x, y, a=1.0, b=3.0, c=1.0, d=5.0, r=0.01, s=4.0, x1=-1.6, I_ext=3.0, **kwargs)[source]

Hindmarsh-Rose neuron model: 3D bursting dynamics.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [x, y, z] (membrane, recovery, slow).

  • a (float) – Model parameter.

  • b (float) – Model parameter.

  • c (float) – Model parameter.

  • d (float) – Model parameter.

  • r (float) – Model parameter.

  • s (float) – Model parameter.

  • x1 (float) – Model parameter.

  • I_ext (float) – External current.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rabinovich_fabrikant(x, y, gamma=0.87, alpha=1.1, **kwargs)[source]

Rabinovich-Fabrikant system: chaotic attractor.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • gamma (float) – Parameter γ.

  • alpha (float) – Parameter α.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.chua_circuit(x, y, alpha=15.6, beta=28.0, m0=-1.143, m1=-0.714, **kwargs)[source]

Chua circuit: electronic chaotic oscillator.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [x, y, z] (voltages, current).

  • alpha (float) – Parameter α.

  • beta (float) – Parameter β.

  • m0 (float) – Piecewise slope 1.

  • m1 (float) – Piecewise slope 2.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.selkov_glycolysis(x, y, a=0.05, b=0.5, **kwargs)[source]

Sel’kov model: glycolysis oscillations.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [x, y] (ADP, F6P concentrations).

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.competitive_lotka_volterra_3(x, y, r1=1.0, r2=1.0, r3=1.0, a12=0.5, a13=0.5, a21=0.5, a23=0.5, a31=0.5, a32=0.5, **kwargs)[source]

Competitive Lotka-Volterra: 3 species competition.

dN_i/dt = r_i·N_i·(1 - N_i - Σ a_ij·N_j). f₀=N₁, f₁=N₂, f₂=N₃.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [N₁, N₂, N₃] (species populations).

  • r1 (float) – Growth rate of species 1.

  • r2 (float) – Growth rate of species 2.

  • r3 (float) – Growth rate of species 3.

  • a12 (float) – Competition coefficient of 2 on 1.

  • a13 (float) – Competition coefficient of 3 on 1.

  • a21 (float) – Competition coefficient of 1 on 2.

  • a23 (float) – Competition coefficient of 3 on 2.

  • a31 (float) – Competition coefficient of 1 on 3.

  • a32 (float) – Competition coefficient of 2 on 3.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.lu_chen(x, y, a=36.0, b=3.0, c=20.0, **kwargs)[source]

Lü-Chen system: bridge between Lorenz and Chen attractors.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.aizawa_attractor(x, y, a=0.95, b=0.7, c=0.6, d=3.5, e=0.25, f_param=0.1, **kwargs)[source]

Aizawa attractor: 3D chaotic system.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • d (float) – Parameter d.

  • e (float) – Parameter e.

  • f_param (float) – Parameter f.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.cubic_decay(x, y, k=1.0, **kwargs)[source]

y’ = -k·y³ — Cubic decay (nonlinear).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • k (float) – Decay rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.sqrt_growth(x, y, k=0.5, **kwargs)[source]

y’ = k·√y — Square-root growth (e.g. droplet).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • k (float) – Growth rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.bistable(x, y, a=0.5, **kwargs)[source]

y’ = y(1-y)(y-a) — Bistable (cubic with 3 equilibria).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • a (float) – Bistability parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.landau(x, y, **kwargs)[source]

y’ = y - y³ — Landau potential (pitchfork).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.cubic_oscillator(x, y, **kwargs)[source]

y’’ = -y³ — Pure cubic oscillator.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.bernoulli_decay(x, y, k=1.0, n=2.0, **kwargs)[source]

y’ = -k·y^n — Bernoulli-type decay.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • k (float) – Decay rate.

  • n (float) – Exponent.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.holling_type2(x, y, r=1.0, K=10.0, c=1.0, **kwargs)[source]

y’ = r·y·(K-y)/(K+c·y) — Holling type II growth.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • c (float) – Holling parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.soft_spring(x, y, omega=1.0, eps=0.1, **kwargs)[source]

y’’ = -ω²y - εy³ — Soft spring (Duffing).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • omega (float) – Natural frequency.

  • eps (float) – Nonlinearity parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.quadratic_decay(x, y, a=1.0, b=0.5, **kwargs)[source]

y’ = a - b·y² — Quadratic decay with source.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • a (float) – Source rate.

  • b (float) – Decay coefficient.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.cubic_landau(x, y, **kwargs)[source]

y’ = y(1-y²) — Cubic (symmetric bistable).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.smooth_decay(x, y, **kwargs)[source]

y’ = -y/(1+y²) — Smooth decay.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.gompertz_harvesting(x, y, r=0.5, K=10.0, d=0.1, **kwargs)[source]

y’ = r·y·ln(K/y) - d·y — Gompertz with harvesting.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • d (float) – Harvesting rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.damped_pendulum(x, y, g=9.81, L=1.0, gamma=0.5, **kwargs)[source]

y’’ + (g/L)sin(y) + γ·y’ = 0 — Damped pendulum.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [θ, θ'].

  • g (float) – Gravitational acceleration.

  • L (float) – Pendulum length.

  • gamma (float) – Damping coefficient.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.lienard(x, y, mu=1.0, **kwargs)[source]

y’’ + μ(y²-1)y’ + y = 0 — Liénard (Van der Pol-like).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • mu (float) – Nonlinearity parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.matthew_equation(x, y, a=1.0, q=0.5, **kwargs)[source]

y’’ + (a - 2q·cos(2x))y = 0 — Mathieu equation.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y, y'].

  • a (float) – Mathieu parameter.

  • q (float) – Mathieu parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.legendre_ode(x, y, n=2.0, **kwargs)[source]

(1-x²)y’’ - 2xy’ + n(n+1)y = 0 — Legendre.

Return type:

ndarray

Parameters:
config.equations.blasius_type(x, y, **kwargs)[source]

y’’’ = -y·y’’/2 — Blasius (simplified). y=[f,f’,f’’].

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [f, f', f''].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.emden_fowler(x, y, n=5.0, **kwargs)[source]

y’’ + (2/x)y’ + y^n = 0 — Emden-Fowler (polytropic).

Parameters:
  • x (float) – Independent variable (x > 0).

  • y (ndarray) – State vector [y, y'].

  • n (float) – Polytropic index.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.fisher_kpp(x, y, r=1.0, **kwargs)[source]

y’ = r·y(1-y) — Fisher-KPP (spatial would need diffusion).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.malthus_harvesting(x, y, r=0.5, h=0.1, **kwargs)[source]

y’ = r·y - h — Malthus with constant harvesting.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • r (float) – Growth rate.

  • h (float) – Harvesting rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.relu_activation(x, y, k=1.0, **kwargs)[source]

y’ = k·max(0, y) — ReLU-like activation (linear for y>0).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • k (float) – Slope for y > 0.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.tanh_decay(x, y, k=1.0, **kwargs)[source]

y’ = -k·tanh(y) — Tanh decay (smooth).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [y].

  • k (float) – Decay rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.halvorsen_attractor(x, y, a=1.89, **kwargs)[source]

Halvorsen attractor: chaotic 3D.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.dadras_attractor(x, y, a=3.0, b=2.7, c=1.7, d=2.0, e=9.0, **kwargs)[source]

Dadras attractor: chaotic 3D.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • d (float) – Parameter d.

  • e (float) – Parameter e.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.sprott_s(x, y, **kwargs)[source]

Sprott S system: chaotic 3D.

Return type:

ndarray

Parameters:
config.equations.sprott_a(x, y, **kwargs)[source]

Sprott A system: chaotic 3D.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.three_species_food_chain(x, y, r=1.0, a1=2.0, a2=2.0, b1=0.1, b2=0.1, d1=0.4, d2=0.1, **kwargs)[source]

Rosenzweig-MacArthur 3-species food chain. f₀=prey, f₁=pred1, f₂=pred2.

Return type:

ndarray

Parameters:
config.equations.sirs_epidemic(x, y, beta=0.5, gamma=0.2, xi=0.1, **kwargs)[source]

SIRS: dS/dt=-βSI+ξR, dI/dt=βSI-γI, dR/dt=γI-ξR.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [S, I, R] (susceptible, infected, recovered).

  • beta (float) – Transmission rate.

  • gamma (float) – Recovery rate.

  • xi (float) – Waning immunity rate.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.seir_epidemic(x, y, beta=0.5, sigma=0.1, gamma=0.2, **kwargs)[source]

SEIR: S→E→I→R. f₀=S, f₁=E, f₂=I, f₃=R.

Return type:

ndarray

Parameters:
config.equations.oregonator(x, y, q=0.0008, f=1.0, eps=0.01, **kwargs)[source]

Oregonator: Belousov-Zhabotinsky reaction.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [u, v, w] (concentrations).

  • q (float) – Parameter q.

  • f (float) – Parameter f.

  • eps (float) – Parameter eps.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.morris_lecar(x, y, phi=0.04, g_ca=1.1, g_k=2.0, g_l=0.5, v_ca=1.0, v_k=-0.7, v_l=-0.5, v1=-0.01, v2=0.15, v3=0.1, v4=0.145, I_ext=0.0, **kwargs)[source]

Morris-Lecar neuron model.

Return type:

ndarray

Parameters:
config.equations.wilson_cowan(x, y, tau_e=1.0, tau_i=1.0, w_ee=12.0, w_ei=4.0, w_ie=13.0, w_ii=11.0, I_e=1.0, I_i=0.0, **kwargs)[source]

Wilson-Cowan: excitatory-inhibitory neural populations.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [e, i] (excitatory, inhibitory).

  • tau_e (float) – Excitatory time constant.

  • tau_i (float) – Inhibitory time constant.

  • w_ee (float) – Connection weights.

  • w_ei (float) – Connection weights.

  • w_ie (float) – Connection weights.

  • w_ii (float) – Connection weights.

  • I_e (float) – External inputs.

  • I_i (float) – External inputs.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.goodwin_oscillator(x, y, k=1.0, b=1.0, n=9.0, **kwargs)[source]

Goodwin oscillator: gene regulation.

Return type:

ndarray

Parameters:
config.equations.t_system(x, y, a=2.0, b=0.5, c=1.0, **kwargs)[source]

T system: chaotic 3D.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.finance_chaos(x, y, a=0.001, b=0.2, c=1.1, **kwargs)[source]

Finance system: chaotic.

Return type:

ndarray

Parameters:
config.equations.arneodo(x, y, a=-5.5, b=3.5, c=-1.0, **kwargs)[source]

Arneodo system: chaotic.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.bouali_attractor(x, y, a=0.3, s=1.0, **kwargs)[source]

Bouali attractor: chaotic.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • s (float) – Parameter s.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.nose_hoover(x, y, **kwargs)[source]

Nose-Hoover: thermostat (Hamiltonian-like).

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [q, p, ζ].

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.dee_attractor(x, y, a=1.0, b=0.1, **kwargs)[source]

Dee attractor: chaotic.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.four_wing(x, y, a=4.0, b=6.0, c=10.0, **kwargs)[source]

Four-wing attractor.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.genesi_attractor(x, y, a=0.44, b=1.1, c=1.0, **kwargs)[source]

Genesiş attractor: chaotic.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.qi_chaos(x, y, a=14.0, b=5.0, c=1.0, **kwargs)[source]

Qi system: chaotic.

Return type:

ndarray

Parameters:
config.equations.wang_sun_chaos(x, y, a=10.0, b=40.0, c=2.5, d=5.0, **kwargs)[source]

Wang-Sun chaotic system.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • d (float) – Parameter d.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.predator_prey_ratio(x, y, r=1.0, a=1.0, b=0.5, e=0.5, m=0.2, **kwargs)[source]

Ratio-dependent predator-prey: f₀=prey, f₁=predator.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [prey, predator].

  • r (float) – Prey growth rate.

  • a (float) – Predation rate.

  • b (float) – Ratio parameter.

  • e (float) – Conversion efficiency.

  • m (float) – Predator mortality.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.leslie_gower(x, y, r=1.0, a=1.0, c=0.5, d=0.1, **kwargs)[source]

Leslie-Gower predator-prey: modified carrying capacity.

Return type:

ndarray

Parameters:
config.equations.holling_tanner(x, y, r=1.0, a=1.0, b=0.5, e=0.5, m=0.2, **kwargs)[source]

Holling-Tanner: predator-prey with prey-dependent growth.

Parameters:
  • x (float) – Independent variable (time).

  • y (ndarray) – State vector [prey, predator].

  • r (float) – Prey growth rate.

  • a (float) – Predation rate.

  • b (float) – Half-saturation.

  • e (float) – Conversion efficiency.

  • m (float) – Predator mortality.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.rossler_hyperchaos(x, y, a=0.25, b=3.0, c=0.5, d=0.05, **kwargs)[source]

Rössler hyperchaos: 4D.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z, w].

  • a (float) – Parameter a.

  • b (float) – Parameter b.

  • c (float) – Parameter c.

  • d (float) – Parameter d.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.equations.hyperchaos_lorenz(x, y, a=10.0, b=28.0, c=2.6666666666666665, r=0.5, **kwargs)[source]

Lorenz 4D hyperchaos.

Parameters:
  • x (float) – Independent variable.

  • y (ndarray) – State vector [x, y, z, w].

  • a (float) – Parameter a (Prandtl-like).

  • b (float) – Parameter b (Rayleigh-like).

  • c (float) – Parameter c.

  • r (float) – Fourth dimension coupling.

  • **kwargs (Any) – Ignored.

Return type:

ndarray

Returns:

dy/dx as 1-D numpy array.

config.difference_equations

Difference equation (recurrence) functions.

Functions here are callable as f(n, y, **params) and return the next value (scalar). They can be referenced from config/equations/*.yaml via function_name for equation_type: difference.

config.difference_equations.cobweb_model(n, y, r=2.5, K=1.0, **kwargs)[source]

y_{n+1} = r * y_n * (1 - y_n/K) — Discrete logistic (Ricker-type).

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+1}.

config.difference_equations.ricker_model(n, y, r=2.5, **kwargs)[source]

y_{n+1} = r * y_n * exp(-y_n) — Ricker model (fish populations).

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n].

  • r (float) – Growth parameter.

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+1}.

config.difference_equations.beverton_holt(n, y, r=2.0, K=100.0, **kwargs)[source]

y_{n+1} = r * y_n / (1 + (r-1)*y_n/K) — Beverton-Holt (stock recruitment).

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n].

  • r (float) – Growth rate.

  • K (float) – Carrying capacity.

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+1}.

config.difference_equations.tent_map(n, y, mu=2.0, **kwargs)[source]

y_{n+1} = μ·min(y_n, 1-y_n) — Tent map (chaotic dynamics).

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n].

  • mu (float) – Parameter (typically 2).

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+1}.

config.difference_equations.third_order_recurrence(n, y, a=1.0, b=0.5, c=0.25, **kwargs)[source]

y_{n+3} = a·y_{n+2} + b·y_{n+1} + c·y_n — Third-order linear recurrence.

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n, y_{n+1}, y_{n+2}].

  • a (float) – Coefficient of y_{n+2}.

  • b (float) – Coefficient of y_{n+1}.

  • c (float) – Coefficient of y_n.

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+3}.

config.difference_equations.gauss_map(n, y, beta=6.0, **kwargs)[source]

y_{n+1} = exp(-β·y_n²) — Gauss map (chaotic).

Parameters:
  • n (int) – Discrete index.

  • y (ndarray) – State vector [y_n].

  • beta (float) – Parameter.

  • **kwargs (Any) – Ignored.

Return type:

float

Returns:

Next value y_{n+1}.