WIKI/Reward & Motivation/Experiment Lab
Reward & Motivation

Experiment Lab

The Experiment Lab (services/experiment_lab.py, 4,209 lines) is Frank's autonomous research facility — 7 simulation stations that let him run real experiments without leaving his chair.

7 Experiment Stations

1. Physics Station

8 simulation types with classical mechanics:

Simulation What It Computes
Projectile Trajectory, range, max height — full kinematics
Collision Elastic/inelastic momentum conservation
Pendulum Simple harmonic motion, period, amplitude
Incline Friction dynamics, acceleration on slopes
Magnetic Field Ampère's law — solenoid & wire current
Magnetic Levitation Ferromagnetic sphere equilibrium
Electric Field Coulomb forces between point charges
Spring Hooke's law harmonic oscillators
Wave Frequency, wavelength, velocity

Example: Frank hypothesizes that a 45° angle maximizes projectile range. He runs the experiment. The physics station simulates the trajectory. The hypothesis engine records: confirmed (in vacuum) or refuted (with air resistance, it's ~43°).

2. Quantum Lab

6 simulation types — actual quantum state vector math:

  • Qubit Simulation: State vectors, gate sequences (H, X, Y, Z, T, S, CNOT), measurement probabilities
  • Variational Quantum Circuits: VQC for logic gate approximation
  • Quantum Effects: Tunneling (WKB approximation), double-slit interference, harmonic oscillator
  • Entanglement: Bell states, CHSH inequality tests, quantum teleportation
  • QUBO: Quadratic Unconstrained Binary Optimization — brute-force + simulated annealing
  • World Model: Free energy minimization, Bayesian belief updates

Uses numpy for matrix operations, sympy for symbolic math. Not a toy — these are real quantum mechanics calculations.

3. Astronomy Orrery

N-body gravitational simulation with leapfrog integration.

5 presets: inner solar system, Earth-Moon, binary star, three-body problem, Jupiter system. Tracks energy conservation (ΔE/E%), orbit radii per body. You can ask Frank "what would happen if Earth were 10% closer to the Sun?" and get a numerically simulated answer.

4. Game of Life Sandbox

Conway's Game of Life with 8 preset patterns: glider, blinker, block, R-pentomino, acorn, pulsar, loafer, methuselah. Configurable grid size and step count. Frank uses this to test emergence hypotheses — simple rules producing complex behavior.

5. Electronics Station

Circuit analysis with real component math:

  • Voltage Divider: Resistor voltage distribution
  • RC Circuit: Charging/discharging curves, time constants
  • RL Circuit: Inductor response, L/R time constants
  • RLC Resonance: Resonant frequency, Q factor
  • Bode Plot: Frequency response — magnitude and phase

6. Math Station

Symbolic and numerical computation via sympy:

  • Polynomial root finding (quadratic through quartic)
  • Symbolic differentiation
  • Numerical integration (trapezoid, Simpson's rule)
  • Matrix eigenvalue decomposition
  • Linear system solving (Gaussian elimination)
  • Fibonacci sequence generation with growth rate analysis

7. GAN Lab

Adversarial training simulations with actual PyTorch neural networks (~80-200 params each):

  • Digit Synthesis: Generator vs. Discriminator (MNIST-style)
  • Point Cloud: 2D generative modeling
  • Mode Collapse: Multi-modal distribution learning analysis
  • Balance: Adversarial equilibrium metrics

Budget & Safety

Limit Value Why
Daily experiments 20 Prevents runaway LLM token usage
Dedup window 48 hours Identical params within 2 days → cached result
Timeout 10 seconds Hard limit per simulation
Output cap 2,000 chars Narration truncated for context window
Imagination leak filter Active Rejects fantasy/spatial narrative contamination

How It Works End-to-End

  1. The Hypothesis Engine creates a hypothesis: "Friction coefficient > 0.5 prevents sliding on a 30° incline"
  2. It calls request_experiment() with station=physics, type=incline, params={angle: 30, friction: 0.5}
  3. The lab checks the daily budget (atomic increment in experiment_budget table)
  4. The physics station runs the simulation — pure Python + numpy
  5. The result is stored in experiment_lab.db with station, params, result JSON, and narration
  6. The hypothesis engine interprets the result: confirmed/refuted/inconclusive
  7. The hypothesis is updated with the experimental evidence

All of this happens autonomously while Frank is idle. No user input required.

MORE IN REWARD & MOTIVATION

← ALL ARTICLES