top of page
Search

AI Testing platform: Stone-Mackey-Glass Chaos Simulation

Updated: Aug 20



How to Run

  1. Open the HTML file in any modern browser (Chrome, Firefox, etc.).

  2. The simulation runs automatically on load.

  3. Adjust the parameters:

    • β: Feedback strength (e.g. 0.2)

    • γ: Decay rate (e.g. 0.1)

    • n: Nonlinearity (e.g. 10)

    • τ: Delay in steps (e.g. 25)

    • Steps: Simulation length (e.g. 1200)

    • dt: Time step (e.g. 0.1)

  4. Click “Simulate” to update the graph.

Features

Button

What It Does

Simulate

Runs the model with your settings

Save as PNG

Downloads the chart image

Toggle Phase Plot

Switches between time series and phase-space plot

Example Use Cases

AI Task

How

Time-series forecasting

Use x(t) values for training LSTM/RNN models

Reservoir computing

Feed chaotic inputs into echo state networks

Anomaly detection

Add noise and train a model to detect changes

Chaos visualization

Use phase-space plot for attractor patterns

Tips

  • Use larger τ (delay) for more chaotic behavior.

  • Keep β around 0.2, γ around 0.1, n at 10 for canonical results.

  • Use phase plot (x(t) vs x(t - τ)) to explore attractors.


User Guide for AI Engineers

Mackey-Glass Time Series Simulator (HTML/JS)


Chaos Modeling | Delay Differential Equation | Dynamic Systems Analysis

Overview

This simulator implements the Mackey-Glass delay differential equation, a classical chaotic system frequently used in:

  • Time series forecasting

  • Nonlinear systems modeling

  • Chaos theory experimentation

  • Recurrent Neural Network training

  • Echo State Networks (ESNs) and Reservoir Computing



    Equation Implemented


dtdx(t)​=β⋅1+x(t−τ)nx(t−τ)​−γ⋅x(t)

  • β (beta): Feedback strength

  • γ (gamma): Decay rate

  • n: Nonlinearity exponent

  • τ (tau): Delay (memory)

  • dt: Time step (Euler integration)

⚙️ Parameters and UI Controls

Control

Description

β

Controls strength of the feedback loop. Higher = more chaos.

γ

Controls decay of the signal. Higher = faster damping.

n

Governs system nonlinearity. Integer values like 10 are standard.

τ

Time delay. Larger τ generally increases chaos.

Steps

Number of iterations to simulate.

dt

Time increment per step (Euler method precision).

Simulate

Runs the simulation using above parameters.

Save as PNG

Downloads the current plot image.

Toggle Phase Plot

Switches between time-series and phase-space plot: x(t) vs x(t-τ)

📊 Visualization Modes

1. Time Series Plot

  • X-axis: time (t)

  • Y-axis: x(t)

  • Interprets how system evolves over time.

2. Phase-Space Plot

  • X-axis: x(t - τ)

  • Y-axis: x(t)

  • Visualizes strange attractors and system memory behavior.

🛠️ How It Works Internally

  • Uses Euler integration to simulate delay differential dynamics.

  • Uses JavaScript arrays to simulate delayed memory x(t - τ).

  • Uses Plotly.js to dynamically draw charts (responsive, zoomable).

📈 Extension Ideas for AI Engineers

✅ 1. Data Export

  • Export simulated x(t) values as CSV/JSON for ML training.

js

CopyEdit

function exportData(x, dt) {  const data = x.map((val, i) => `${(i * dt).toFixed(3)},${val.toFixed(5)}`).join('\n');  const blob = new Blob([`time,x\n${data}`], { type: 'text/csv' });  const url = URL.createObjectURL(blob);  const link = document.createElement('a');  link.href = url;  link.download = 'mackey_glass_data.csv';  link.click(); }

✅ 2. Training Dataset Generator

  • Use different τ, β, γ values to generate diverse time series for:

    • RNN training

    • ESN state evolution

    • GAN-based synthetic data

✅ 3. Real-Time Dynamic System Training

  • Embed into a TensorFlow.js or Pyodide frontend for in-browser training:

    • Train a model to predict future x(t + Δt)

    • Use past x(t - τ)...x(t) as input

✅ 4. 3D Attractor Visualization

  • Use Plotly’s 3D scatter mode:

    js

    CopyEdit

    trace3D = {  x: x.slice(0, steps - 2 tau),  y: x.slice(tau, steps - tau),  z: x.slice(2 tau, steps),  mode: 'lines',  type: 'scatter3d' }

✅ 5. Noise Injection & Robustness Testing

  • Add Gaussian or uniform noise:

    js

    CopyEdit

    const noise = (Math.random() - 0.5) noiseFactor; x.push(xt + dt dx + noise);

🤖 Use Cases in AI

Application

How

Time-Series Prediction

Use x(t), x(t-τ), ... as input to RNN/Transformer/MLP.

Reservoir Computing

Mackey-Glass is a benchmark signal for echo state networks.

Chaos Classification

Train classifier to detect chaotic vs stable regimes (vary τ).

Sequence Autoencoders

Learn latent representation of chaotic signals.

Anomaly Detection

Add external perturbations and detect them with ML models.

🧠 Tips for Advanced AI Engineers

  • Perform Lyapunov exponent estimation using trajectory divergence.

  • Test sequence prediction robustness under parameter drift.

  • Study bifurcation diagrams by sweeping τ from 0–100.

  • Use multiple τ-lagged values as state vectors for LSTM inputs:

    xt​=[x(t),x(t−τ),x(t−2τ)]

📎 Integration Ready

  • No frameworks required — native JavaScript.

  • Copy-paste into any browser-based platform.

  • Easily extendable into React, Vue, or JupyterLite.

💡 Final Notes






Auxilary Editions:










































ree

Mackey-Glass Chaos Simulation – User Guide

Overview

This interactive simulation visualizes the Mackey-Glass time series — a famous example of a chaotic system. It includes a 3D-like field representation where the circumference (field strength) modulates based on the system’s state. Use input sliders to tweak system parameters and observe how chaos emerges in real-time.

Interface Overview

  • Graph: Displays x(t) over time with modulated radius (field effect).

  • Input Controls:

    • β (beta): Controls the growth rate.

    • γ (gamma): Damping coefficient.

    • n: Power term, affecting nonlinearity.

    • τ (tau): Delay, introduces memory into the system.

    • Steps: Number of iterations.

    • π Multiplier: Scalar applied to third axis (field representation).

  • Simulate Button: Runs the model with the current parameters.

How to Use

  1. Launch the Page – The graph runs automatically with default values.

  2. Adjust Parameters – Use input boxes to change β, γ, n, τ, steps, and π.

  3. Click “Simulate” – Graph will update dynamically.

  4. Interpret the Field – Radius grows/shrinks based on x(t) magnitude.

Example Usage Scenarios

  • Educational: Teach chaotic systems and delay differential equations.

  • AI/ML Engineering: Use as time-series test data for prediction models.

  • Signal Processing: Analyze frequency/field patterns in nonlinear systems.

  • Art/Design: Generate unique chaotic field-based patterns.

Notes

  • Changing tau to higher values often leads to more chaos.

  • The π field modulation is optional but enables richer visual structure.

  • The model does not use real-time differential equations (discrete approximation).

Troubleshooting

  • No graph? Ensure JavaScript is enabled in your browser.

  • Unexpected output? Try reducing steps or setting more stable β, γ


Above and below:

Feature

Original Line Plot

Tube/Circumference Plot

Thickness

Constant

Variable (scales with y(t))

Encodes magnitude visually

Only via position

Position and thickness

Field effect

Implied by color or 3D

Explicitly shown as geometry

Interpretation

Pure trajectory

Trajectory + local “energy/intensity”

Visual style

Minimalist, analytic

More physical, spatial, artistic


 
 
 

Comments


bottom of page