So far we've talked about representing data using (n-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.
Let's start with the example of the unit circle (which we are calling S1). This is defined to be the set of points in the plane which are at distance 1 from the origin (0,0). Using the Pythagorean theorem (to be discussed in the next chapter), this translates to
{(x,y)∈R2∣x2+y2=1}.
For example, (1,0),(0,−1), and (22,22) are in the unit circle since
12+0202+(−1)2(22)2+(22)2=1=1=21+21=1
and (0.3,0.7) is not since
0.32+0.72=0.09+0.49=0.58=1.
So this description of the unit circle makes it easy to check whether a given point (x,y) is in S1 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 x, e.g. x=0.3. We can rearrange the equation for the circle as follows:
x2+y2y2y=1=1−x2=±1−x2
In our case x=0.3, the possibilities for y are ±0.7. In general, once we fix a value of x, we get either one or two options for y (one option if 1−x2=0, i.e. when x=±1.
However, not every value of x is possible, since we can't take the square root of a negative number. Let's solve for the constraint on x:
1−x211≥0≥x2≥∣x∣
which is equivalent to
−1≤x≤1.
In other words, x∈[−1,1].
We now have two maps
f+,f−:[−1,1]→S1⊂R2
given by
f+(x)f−(x)=(x,−1−x2)=(x,−1−x2)
With this description, it's easy to produce examples of points on the unit circle: we just plug in any value of x between −1 and 1. On the other hand, it's difficult to check whether a given point, say (0.71,0.73), is on the unit circle: we'd need to reverse the above derivation.
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 (0,?), namely (0,1) and (0,−1). However, it's always possible to find explicit descriptions locally:
y=1−x2
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.
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 S be the space of all possible situations like this. Given such a situation s∈S, there are various quantities we can measure:
the kinetic energy E(s) of the object;
the mass m(s) of the object;
the speed v(s) 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
E,m,v:S→R.
Recall that three maps S→R can equivalently be viewed as a single map
(E,m,v):S→R3.
Not every point (x,y,z)∈R3 can be hit by this map: physics tells us that these quantities must satisfy the constraint
E=21mv2
so we will only hit points in
{(x,y,z)∈R3∣x=21yz2}.
In many cases, it is difficult to find a "global" coordinate system, but we may be able to find a local coordinate system
(x1,…,xn):U→Rn
where U⊂S is a subset of S (similar to local parametrizations, above).
The upshot of this discussion is that we can view parametrizations of X as maps Rn→X, and coordinate systems on X as maps X→Rn. This also applies to local parametrizations/coordinate systems if we allow a subspace U⊂X in place of the entire X.
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
2y(y2−3x2)(1−z2)+(x2+y2)2−(9z2−1)(1−z2)=0
(I just took this example from Wikipedia). If we plug in the point (0.5,0.9,0.9), the left-hand side works out to ≈−0.051. That means this point is not in S. But −0.051 is close to 0, so there's probably a point near(0.5,0.9,0.9) which is in S.
Therefore, we can try to graph an implicit equation as follows. We'll restrict our attention to some box, like the cube [−1,1]3; 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: