Devlog #76 – Wave 56: Light Polarization, Student’s t-Test & Battery Electrochemistry

This wave spans three distinct fields — optics, statistics, and energy chemistry — adding an interactive polarization explorer, a complete hypothesis-testing suite for Student’s t-test, and a Li-ion battery simulator with Butler-Volmer kinetics. The library now sits at 544 simulations.

🌂 Wave 56 — 544 simulations total
544
Total simulations
3
Added this wave
76
Devlog session
56
Release wave

New Simulations

🔮

Light Polarization

Malus’s Law, Brewster’s angle with Fresnel equations, animated wave view (5 polarization types), and birefringence with wave-plate retardation.

📊

Student’s t-Test

One-sample, two-sample independent, and paired t-tests. Live t-distribution with p-value shading, 95% CI, Cohen’s d effect size, and statistical power.

🔋

Battery Electrochemistry

Li-ion charge/discharge curves, C-rate discharge family with Ragone plot, capacity fade (SEI growth + lithium plating), Butler-Volmer kinetics, and Nyquist impedance sketch.

🔮 Light Polarization

Polarization is one of the most versatile concepts in wave optics and this simulation covers it in four independent interactive modes.

Malus’s Law Mode

Three polarizers are chained. The user adjusts each polarizer’s angle and watches intensity values update in real time according to I = I₀ · cos²(θ). A bar graph shows each stage’s fraction of the original light. Rotating the analyzer from 0° to 90° collapses the beam to zero — Malus’s Law in one drag.

Brewster’s Angle Mode

Full Fresnel equations are computed live:

rs = (n₁cosθᵢ − n₂cosθₜ) / (n₁cosθᵢ + n₂cosθₜ)
rp = (n₂cosθᵢ − n₁cosθₜ) / (n₂cosθᵢ + n₁cosθₜ)
Rs = rs²,  Rp = rp²

At Brewster’s angle (θ_B = arctan(n₂/n₁)), Rp = 0 and the reflected beam is completely s-polarized, visualised by a split graph of Rs and Rp vs incidence angle with the Brewster marker clearly labeled.

Wave View Mode

Five polarization states are animated simultaneously — linear, right-circular (RCP), left-circular (LCP), elliptical, and unpolarized — by drawing the Ex and Ey component traces on a time axis and the resulting 2D Lissajous figure in the transverse plane.

Birefringence Mode

A wave plate with variable retardation Γ (0–2π) and fast-axis angle rotates an input polarization state. The Stokes S3 (circular component) is plotted as a function of fast-axis angle to show how a quarter-wave plate (Γ = π/2) converts linear to circular polarization.

📊 Student’s t-Test

Null-hypothesis significance testing is foundational to science, yet the ideas are notoriously difficult to build intuition about. This simulation provides three test variants side-by-side with numerical and visual feedback.

Test Types

Three t-test designs are available via tabs:

Statistics Computed

t-Distribution Visualizer

The lower canvas shows the t(df) distribution with:

Implementation Notes

All statistics are computed purely in JavaScript. The p-value is derived from the t-CDF using a Lanczos-approximated logGamma and a Lentz continued-fraction evaluation of the regularised incomplete beta function — accurate to five decimal places across the typical range of df. A seeded Mulberry32 PRNG (splitmix32) is used so slider drags produce reproducible samples.

🔋 Battery Electrochemistry

Li-ion batteries power everything from phones to electric vehicles, yet their electrochemical behaviour is rarely made interactive. This simulation has four linked modes.

Charge / Discharge Mode

A simplified NMC OCV model is used:

OCV(SoC) = 3.0 + 1.2·s − 0.4·s² + 0.3·sin(π·s) − 0.05·cos(2π·s)

During a CC (constant current) discharge the terminal voltage drops by I · R_int. When charging, the algorithm switches to a CV (constant voltage) phase when the terminal voltage reaches 4.2 V, tapering the current to simulate real BMS behaviour. A temperature correction factor (exp(−0.008·(T−25)²/298)) reduces effective capacity at cold temperatures.

C-Rate Mode

Five discharge curves are plotted simultaneously: C/5, C/2, 1C, 2C, 5C. Higher C-rates cause larger IR drops, reducing the usable capacity before the 3.0 V cutoff is reached. A Ragone plot (energy vs power density) is computed from the area under each curve and displayed in the lower canvas.

Capacity Fade Mode

Three degradation mechanisms are modelled:

The combined fade curve highlights the End-of-Life (EoL) point at 80% capacity retention, matching the standard industry definition.

Butler-Volmer Mode

The core electrode kinetic equation is plotted interactively:

i = i₀ · [exp(α·F·η / RT) − exp(−(1−α)·F·η / RT)]

Users control the exchange current density i₀, transfer coefficient α, and temperature. The anodic and cathodic half-currents are shown as separate dashed lines. The anodic Tafel slope (RT/(αF) · ln(10)) is computed and displayed. The lower canvas shows a sketch of the corresponding Nyquist impedance plot, with the ohmic resistance intercept and the charge-transfer resistance semicircle radius both derived from i₀.

Technical Notes

What’s Next

Upcoming candidates from the queue include quantum tunnelling, orbital mechanics (Hohmann transfer), cellular automaton rule explorer, and a protein folding coarse-grained model. The 550-simulation milestone is within reach in the next 2–3 sessions.

← Devlog #75 – Wave 55 All posts →