Parameters & Coordinates
So far we've talked about representing data using (-tuples of) numbers. In this post I want to take a closer look at how we do this, and distinguish between two different ways of describing spaces.
Example: the unit circle
Let's start with the example of the unit circle (which we are calling ). This is defined to be the set of points in the plane which are at distance 1 from the origin Using the Pythagorean theorem (to be discussed in the next chapter), this translates to
For example, , and are in the unit circle since
and is not since
So this description of the unit circle makes it easy to check whether a given point is in or not. But it's not easy to come up with examples of points on the circle. Let's start by picking a value for , e.g. . We can rearrange the equation for the circle as follows:
In our case , the possibilities for are . In general, once we fix a value of , we get either one or two options for (one option if , i.e. when .
However, not every value of is possible, since we can't take the square root of a negative number. Let's solve for the constraint on
which is equivalent to
In other words,
We now have two maps
given by
With this description, it's easy to produce examples of points on the unit circle: we just plug in any value of between and On the other hand, it's difficult to check whether a given point, say is on the unit circle: we'd need to reverse the above derivation.
Implicit, parametric, and explicit descriptions
Let's generalize what we saw in the above example.
Being able to find an explicit description of a space is rare, since it implies that if you fix all but one coordinate, there is at most one possibility for the last coordinate. This is not true for the circle, since e.g. there are two possibilities for namely and However, it's always possible to find explicit descriptions locally:
is an explicit description of the top half of the circle, even though an explicit description can't exist for the entire circle.
We can think about "solving equations" very generally as trying to convert between implicit and parametric descriptions of a space.
| Check membership | Produce examples | |
|---|---|---|
| Parametric | ✗ | ✓ |
| Implicit | ✓ | ✗ |
| Explicit | ✓ | ✓ |
Coordinates
Let me give a slightly different perspective on implicit descriptions which is more symmetric with parametric descriptions.
Let's think an object in motion, e.g. a cow hurtling through the air, and freeze at a particular moment in time. Let be the space of all possible situations like this. Given such a situation there are various quantities we can measure:
- the kinetic energy of the object;
- the mass of the object;
- the speed of the object.
If we pick units of measurement, (say joules for energy, kilograms for mass, and meters per second for speed), then we can view these as three maps
Recall that three maps can equivalently be viewed as a single map
Not every point can be hit by this map: physics tells us that these quantities must satisfy the constraint
so we will only hit points in
In many cases, it is difficult to find a "global" coordinate system, but we may be able to find a local coordinate system
where is a subset of (similar to local parametrizations, above).
The upshot of this discussion is that we can view parametrizations of as maps and coordinate systems on as maps This also applies to local parametrizations/coordinate systems if we allow a subspace in place of the entire
Marching squares / cubes
We won't be able to solve every system of equations algebraically---in fact, it's extremely rare that we can. So how can we visualize spaces that are given to us implicitly?
We take advantage of the fact that it's easy to test whether a given point belongs to an implicitly defined subspace. Let's take the example
(I just took this example from Wikipedia). If we plug in the point the left-hand side works out to That means this point is not in . But is close to , so there's probably a point near which is in
Therefore, we can try to graph an implicit equation as follows. We'll restrict our attention to some box, like the cube ; maybe we know ahead of time that our space is contained in this box, or maybe it's not and we'll only be graphing part of it. We can subdivide this box, take a bunch of sample points from it, and plug them into our equation. Our sample points will almost certainly not satisfy the equation, but we can use how close/far they are from satisfying the equation to get a good idea of what our shape must look like.
The marching squares / marching cubes algorithms are sophisticated implementations of this basic idea. They let us graph implicitly defined shapes without finding a parametrization, and are used internally by tools like Desmos and Grapher. We need to cover a bit more math in order to fully understand how these algorithms work, but I can give you source code right now: