Designing Geometric Algebras - Tangent Objects
With part 1 of this series we are successfully able to represent any shape as a GA element. One thing we might want is an object representing the tangent space on the object.
In a curve in 2 dimensional space, the tangent space at a point would just be the tangent line at it. In 3 dimensions, the tangent space of a curve would still be a tangent line, but this time it is a line in 3 dimensions instead of 2. If we look at a surface in 3 dimensions, its tangent space at a point on it would be a plane at that point tangent to the surface.
The tangent space is also related to derivatives. In 2D, the derivative of a curve is the slope of it. We can represent the derivative at a specific point by drawing a tangent line at it. For a surface in 3D we can take the derivative in two non-parallel directions on the surface, which will give us tangent lines that together span the tangent plane of the surface.
It would be nice if we had a simple procedure for getting objects representing the tangent space at a point of another object. In the next part we will start by examining parabolas as a concrete example for all of this. In the end we will have a general procedure.
Suppose we want to represent parabolas
in GA. The equation contains four terms , so we need four basis vectors and the up function mapping from points to vectors will be
We could now join three points together into a parabola that goes through all three of them, and extract the intrinsic equation by looking at its Outer Product Null Space / Join Null Space (JNS).
Derivatives and tangent lines
Next we want to figure out the derivative of the parabola. We already know that tangent lines are related to derivatives, so we will try to find the object representing the tangent line at a point on the parabola.
We start by defining a parabola
. Then, given a point represented by the vector on the parabola, how can we get an object representing the line that is tangent the parabola at that point?
The first thing we need to do is make sure the line is actually tangent to the parabola. We could achieve this by taking the point
and taking a small step along the parabola. We call the slightly offset point . Then we need to build up the object representing the line that goes through those two points, so we start by joining the two points.
This will result in a bivector. But curves, including lines, are represented by pseudovectors (trivectors in this case) in our algebra, not bivectors. To get a trivector that represents a line curve, what we need to do is join the
basis vector with our bivector. This ensures that when we look at the JNS, we will only have terms remaining because wedging the trivector with the basis vector again will give zero.
So we arrive at the object we call
that will (hopefully) represent the tangent line. The result of wedging three points into a parabola, and the tangent line through two close points on it is visualized below.
Examining the tangent line object
we will apply the JNS equation to it, which is wedging (joining) a variable point with it.
The result contains the small step
, the x coordinate of the point at which we want the tangent line, the parabola parameters and the variable x parameter of the parabola itself.
If we now define the small step to square to
, we can simplify and solve for .
What does this result mean?
Let's start examining by taking the parabola with parameters
. This would be the parabola . For it, we would expect the tangent line at to be the straight horizontal line .
this means because is the x coordinate of the point where we wanted to have the tangent line.
This is indeed what we expected, so equation
and thus the object from passes this sanity check.
Another check we can make is that the tangent line somehow encodes the derivative. Usually we say that the derivative is the slope of a function at a point on it. In our case our tangent line not only contains the slope, but also the vertical offset.
If we only look at the slope of
, that is, the part proportional to , we have
This is indeed the derivative of the parabola
evaluated at .
We conclude the example with a way to find the tangent space of a curve in 2 dimensions. As a recap, here is what we did:
- Choose basis vectors and an
function to map 2D points to vectors
- Choose an equation for a curve
- Choose a point on the curve
and another point close the first where
- Join the two points and also the basis vectors that do not belong to lines (just the one for
in our parabola example)
- The resulting object represents our tangent line including position offset, its slope is the derivative of the object
Tangent spaces for objects in general
There are two ways we need to generalize here:
First we need to generalize from 2 dimensional space to O dimensional objects (curves are 1D, surfaces are 2D, regardless of the space they lie in). Instead of just just one close point we now have
close points offset by .
Second, We can have
dimensional objects in spaces of dimension where , so there are "extra" dimensions. This means for each extra dimension we need functions that map from the object's parameters to the values in the extra dimensions. In the parabola example, the parabola is a 1D object in 2D space, so we had and we got function for describing the coordinate of the parabola which depends on . For curves in 3D space however we would get functions for the and coordinate depending on .
Third, to build a pseudovector for representing our object, we need to join all the basis vectors not belonging to lines. If
represents the dimensionality of our GA then pseudovectors are dimensional. We wedged points (the point for the tangent and directions), so to get we need to wedge with additional basis vectors. These are all the basis vectors that aren't contained in lines that make up the tangent object. This includes not only those terms with etc., but also those that aren't parameters to the functions.
Another important point is that we need to make sure the basis vectors for representing tangent objects are present in the up function in the first place. If we do not have those, we can not represent the tangent objects at all with our GA.
Algorithm for finding tangent objects
Below I summarize the algorithm for finding tangent objects which we just derived.
- Start with an M-dimensional GA and an up function
that can represent our O-dimensional objects embedded in N-dimensional space, including the tangent objects. In our parabola example, (the GA has 4 basis vectors), (a 1D curve) and (the curve lies in a 2D space).
- We have an object defined by
intrinsic equations (one for each extra "physical" dimension higher than the object itself) for which we want to find the tangent object at arbitrary points on it
- Choose a point
which lies on the object and is where we want to find the tangent object.
points that are close to the chosen point . Do this by introducing that square to zero and adding them to the independent cooordinates of the first point (eg. for a 2D surface in 3D space , ).
- Wedge together all the points, and also all the basis vectors that do not correspond to basis vectors for the lines of the object (those that aren't
and aren't arguments to , there are of them).
- The resulting pseudovector (because we wedged
vectors) represents the tangent object including position offset. Its slopes (terms proportional to which are independent in ) are the derivatives in each direction on the object.
Further improvements and ideas
Small step as a basis vector
For doing the small step sizes we used variable
that square to zero. As a short note, we are already using GA, so we can just introduce new basis vectors for these which square to zero. This makes it very easy to do all of this if you already have access to a GA framework that can deal with basis vectors squaring to zero.
Higher order "tangent" spaces
If you have read my article on automatic differentiation you might remember that we can do higher order automatic differentiation by making the small steps equal to zero when raised to a certain power instead of two (squaring).
We could do the same here to represent not only the first order derivatives (tangents) but also second order and higher ones. For a curve, this would give us a parabola at every point that represents not only represents first order change, but also the second order one-dimensional curvature. For a surface, we would get a paraboloid at every point which also encodes curvature.
We started our quest with objects represented in a GA and wanting to find tangent objects on them, which are also represented in our GA. We derived a method for achieving this by looking at a parabola example. Then we generalized the method so it works in any dimension and on shapes of any number of parameters. Finally we looked some more ideas for improving or expanding on this.
Bonus: Paraboloid surface in 3D and its tangent plane
I tried doing what I did for the parabola above, but for 3D space and a paraboloid in it (
). Its tangent space will be a plane. However, Coffeeshop isn't great at rendering these yet. Here it is anyway. Rotate the camera to see the teal paraboloid, the pink one is the tangent surface, red are points making up the paraboloid and the green points are the three close points making up the tangent plane.