The Korteweg-deVries equation is a nonlinear partial differential equation that describes the motion of “solitons:” waves that are localized and hold their shape as they travel — even after interacting with other solitons. The taller the wave, the faster it goes. They’re beautiful, mesmerizing patterns that arise in a variety of sciences and engineering and you’re watching some right now.

You can play with this equation by adjusting the shape of the initial “bump” when you drag the circle (it’ll appear when your hover over the window). The initial bump will quickly break up into solitons. They cycle across the screen so you can watch for a while and see them interact with each other.

It turns out that any initial disturbance breaks up into a set of solitons that travel to the right and a bit of small wiggles that travel the other way.

Somewhat miraculously — the height of those wave can be precisely predicted by solving Schrödinger’s Equation (yes, that Schrödinger!) for an energy potential that has the shape of the initial disturbance. The number of bound energy states is exactly the number of solitary waves in the KdV system and their energies are the amplitude of the waves!

This seems all way too complicated for a simple web page without a fair bit of physics background, doesn’t it? But you don’t have to solve any of these things, your browser can!

You are watching it actively solve the KdV equation by time-stepping with a 4th order Runge-Kutta method and using spectral methods to handle the spatial derivates.

Solving Schrodinger’s equation as well takes a bit of calculating but, if you press HERE, the wave will pause just to get that calculation done. Solving a nonlinear partial differential equation and an eigenvalue problem at the same time is a lot of hard work for even the speediest of browsers! But when it’s done, you’ll see the waves line up to the right amplitudes.

And that’s a bit of beautiful mathematics behind a seemingly trivial meandering line! But it really demonstrates how powerful your browser is and how much potential it has to do any complicated problem you want to throw at it.