History of `isapprox` in languages

Yes, but I’d like to point out that in most problems one of the first steps we should be doing is creating a dimensionless version of the problem, and that usually means scaling the “typical” value of measurements to be around 1.

Since not everyone may understand what that means, here’s a simple example:

I start with a ball on the end of a spring. The ball has mass m in mass units, the spring has spring constant k in some force units per distance unit, and there is an initial displacement in some distance units. We measure distance as positive upwards from the equilibrium position when we let go of the ball and it stays still.

We have the following differential equation describing the oscillating motion:

m d^2y/dt^2 = -m*g - k*y

There are three dimensions involved in this problem, length, mass, and time, and three constants, m,g,k, Buckingham’s Pi theorem says we can eliminate all the constants by choice of dimensionless scales. Let’s start by dividing the whole thing by m*g to get a dimensionless equation:

1/g d^2y/dt^2 = -1 -(k/(m*g))*y

Now, let’s measure y as a fraction of the distance (m*g/k), so substitute:

(m*g/k) * y' = y
1/g * (m*g/k) d^2 y'/dt^2 = -1 -(m*g/k) * y' * k/(m*g) = -1 - y'
m/k * d^2y'/dt^2 = -1 - y'

Now since everything was dimensionless after dividing by m*g and the left hand side has dt^2 in the denominator, the quantity m/k must have dimensions of time^2 which it does. Let’s measure time as:

sqrt(m/k) * t' = t

we now have:

d^2 y' / dt'^2 = -1 - y'

Literally every mass and spring oscillator can be described by this one equation in which the units are irrelevant. In this conception, an oscillation occurs in about a “unit” of t’, the distance it displaces is about a unit of y’.

6 Likes