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.

Parabola example

Suppose we want to represent parabolasy=ax2+bx+cin GA. The equation contains four terms1,x,x2,y, so we need four basis vectors and the up function mapping from points to vectors will be
(1)up(x)=1e0+xe1+x2e2ye3
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 parabolaf(x)=y=ax2+bx+c. Then, given a point represented by the vectoru=up(ux,f(uy))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 pointuand taking a small stepδxalong the parabola. We call the slightly offset pointv. 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.
(2)uv=up(ux,f(ux))up(ux+δx,f(ux+δx))
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 thex2basis vectore2with our bivector. This ensures that when we look at the JNS, we will only have1,x,yterms remaining because wedging the trivector with thex2basis vector again will give zero.
(3)t=uve2=up(ux,f(ux))up(ux+δx,f(ux+δx))e2
So we arrive at the object we calltthat 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

To examinetwe will apply the JNS equation to it, which is wedging (joining) a variable pointup(x,y)with it.
(4)tup(x,y)=up(ux,f(ux))up(ux+δx,f(ux+δx))e3up(x,y)==δx(δxaux+δxaxaux2+2auxx+bx+cy)=0
The result contains the small stepδx, the x coordinateuxof the point at which we want the tangent line, the parabola parametersa,b,cand the variable x parameter of the parabola itself.
If we now define the small step to square to0, we can simplify and solve fory.
(5)y=(2aux+b)x+(aux2c)
What does this result mean?
Let's start examining by taking the parabola with parametersa=1,b=0,c=0. This would be the parabolaf(x)=y=x2. For it, we would expect the tangent line atx=0to be the straight horizontal liney=0.
For equation(5)this meansux=0becauseuxis the x coordinate of the point where we wanted to have the tangent line.
(6)y=0
This is indeed what we expected, so equation(5)and thus the objecttfrom(3)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(5), that is, the part proportional tox, we have
(7)2aux+b
This is indeed the derivative of the parabolay=2ax+bevaluated atx=ux.
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:
  1. Choose basis vectors and anup(x,y)function to map 2D points to vectors
  2. Choose an equation for a curvey=f(x)
  3. Choose a point on the curve(x,f(x))and another point close the first(x+δx,f(x+δx))whereδx2=0
  4. Join the two points and also the basis vectors that do not belong to lines (just the one forx2in our parabola example)
  5. 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 haveO1close points offset byδx,δy,....
Second, We can haveOdimensional objects in spaces of dimensionNwhereN>O, so there areNO"extra" dimensions. This means for each extra dimension we need functionsfithat 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 hadN=2,O=1and we got21=1function for describing theycoordinate of the parabola which depends onx. For curves in 3D space however we would get31=2functions for theyandzcoordinate depending onx.
Third, to build a pseudovector for representing our object, we need to join all the basis vectors not belonging to lines. IfMrepresents the dimensionality of our GA then pseudovectors areM1dimensional. We wedgedOpoints (the point for the tangent andO1directions), so to getM1we need to wedge withMO1additional 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 withx2etc., but also those that aren't parameters to thefifunctions.
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.
  1. Start with an M-dimensional GA and an up functionup(x1,...,xn)that can represent our O-dimensional objects embedded in N-dimensional space, including the tangent objects. In our parabola example,M=4(the GA has 4 basis vectors),O=1(a 1D curve) andN=2(the curve lies in a 2D space).
  2. We have an object defined byNOintrinsic equationsfi(x1,...,xO)(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
  3. Choose a pointu=(u1,...,uO,f1(u1,...,uO),...,f1+NO(u1,...,uO))which lies on the object and is where we want to find the tangent object.
  4. ChooseO1points that are close to the chosen pointu. Do this by introducingδx,δy,...that square to zero and adding them to the independent cooordinates of the first point (eg. for a 2D surface in 3D spacev=(ux+δx,uy,f(ux+δx,uy)),w=(ux,uy+δy,f(ux,uy+δy))).
  5. 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't1,x,y,...and aren't arguments tofi, there areMOof them).
  6. The resulting pseudovector (because we wedgedO1+(MO)=M1vectors) represents the tangent object including position offset. Its slopes (terms proportional tox,y,...which are independent inf) 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.

Conclusion

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 (f(x,y)=x2+y2). 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.