DEV Community

ANDYSAY
ANDYSAY

Posted on

πŸ”’ The Leonov Sequence: A Recursive Formula for Chaotic Memory and Adaptive Form

What if memory wasn't fixed in neural networks or static matrices β€” but emerged from a recursive, chaotic shape?

Welcome to the Leonov sequence, a novel numerical recurrence that generates structured chaos with memory and serves as the core of wave-memory.

πŸ“ The Formula

The sequence is defined recursively:

L_n = |a_n Β· L_{n-1} + b_n Β· L_{n-2} + c_n Β· L_{n-d_n} / (1 + n)|
Enter fullscreen mode Exit fullscreen mode

Where:

  • a_n, b_n, c_n are random coefficients in range [-2, 2]
  • d_n is a random delay (1 to 10)
  • L_0 = 1, L_1 = 1
  • The |Β·| ensures non-negative dynamics

This formula creates a dynamic, nonlinear, chaotic sequence with built-in decaying memory β€” unlike traditional sequences such as Fibonacci.

πŸ“Š Why Is It Interesting?

Property Leonov Sequence Fibonacci Logistic Map Random Walk
Memory βœ… Yes (d_n lag) ❌ No ❌ No ❌ No
Chaos βœ… Tunable ❌ None βœ… Full chaos βœ… Noise
Entropy 🟑 Moderate πŸ”΅ Low πŸ”΄ High πŸ”΄ High
Autocorrelation βœ… Present βœ… High ❌ None βœ… Random
Application 🧠 Geometry, cognition Math demo Population models Noise models

πŸ¦€ Example in Rust

use wave_memory::{GeoForm, Wave};

fn main() {
    // Create a geometric form using the Leonov sequence
    let mut form = GeoForm::from_leonov(64, 123);

    // Initialize a wave with an impulse at the center
    let mut wave = Wave::new(64, 32);

    // Run the wave and let the form adapt to its energy
    for _ in 0..50 {
        wave.step(&form);
        let energy = wave.energy();
        form.adapt(&energy, 0.1);
    }

    // Inspect a value from the adapted form
    println!("Form at center: {:.4}", form.data[32]);
}

Enter fullscreen mode Exit fullscreen mode

🧠 Applications

  • πŸŒ€ Wave-based memory: used in wave-memory
  • 🧱 Fractal form generation
  • πŸ”¬ Cognitive geometry
  • 🌐 Emergent computation

This sequence is not just a generator β€” it’s a primitive architecture of form that adapts.


Top comments (0)