The relationship between the road and the wheel that rolls smoothly on it is described in detail in the paper by Hall and Wagon. The main point is that if the road is given by the graph of

, then the wheel is given in polar coordinates by

, where

is the solution to the differential equation

, with

. In this Demonstration the road is obtained by periodic interpolation on the locator points. The wheel is then found by numerically solving the numerical differential equation for

. Raising or lowering the road causes the wheel function to be recomputed. The wheel will not always close up in a nice way. Whether it closes depends on whether

is an integer, where

is the half-period of the road, chosen here to be

for consistency with the famous square-wheel case. Choosing 2, 3, or 4 for a closed wheel starts a search, via numerical integration and root-finding, for the height that will work for the desired wheel.