### Designing Geometric Algebras - Interpolating Points

Now for an application that makes use of the fact that we can represent arbitrary shapes as GA objects. Let's start with a concrete example. We have three points which are also shown in the figure below. We want to find$y$ values for other values of$x$ between our three points. This is called interpolation for$x$ between our known points, and extrapolation for$x$ outside of our known points. In other words, we want to find a curve that reasonably interpolates our points.

_{Figure 1 - Blue: Points we want to interpolate.}

A natural choice for a family of curves are polynomials in$x$ , so we will focus on them for now but the procedure outlined in this article will work for any other family of curves too. It turns out that$N$ points unique determine the coefficients of a degree$N-1$ polynomial. For our example,$y={c}_{0}+{c}_{1}x+{c}_{2}{x}^{2}$ is of degree two so its coefficients can be found given three points. The solution we want to find is shown below.

_{Figure 2 - Blue: Points we want to interpolate. Green: Second degree polynomial interpolating the points.}

##### Representing polynomials in Geometric Algebra

In the first section we learnt that we can represent polynomials in Geometric Algebra by introducing a basis vector for each term of it, including the$y$ term. For our concrete example we would have four basis vectors corresponding to$1,x,{x}^{2},y$ and the up function which maps$(x,y)$ points to vectors in the 4D space is

##### Finding the interpolating object

Now we can represent points. How do we get an object representing a curve that goes through all points? We know we can join points together to make shapes which go through all of them with the wedge product. In general we have the following equation which results in the pseudovector$p$ :

Where$N$ is the number of points. This should give us some object representing a shape that goes through all of the points that were joined.

##### Getting the interpolating polynomial coefficients from the object

We can examine this object by applying the Outer Product Null Space / Join Null Space equation:

To bring it into the usual form we still need to bring$y$ on the other side with a coefficient of$1$ . We can also get rid of the pseudoscalar${e}_{1234}$ . This results in

So indeed our object represents a polynomial. In general, to get the ordinary coefficients${c}_{n}$ from$p$ we have

We can see that the coefficients of the polynomial can be directly read off of$p$ 's coefficients. This is all that we needed. We wedged together some points into a pseudovector, we know that the object goes through all of our points, and from the pseudovector's coefficients we can easily get the interpolating polynomial's coefficients.

For our concrete example we have the following pseudovector for representing the polynomial

Reading off the coefficients and dividing by$y$ 's coefficient yields the interpolating polynomial equation

which corresponds exactly to the green curve in the figure 2.

#### Algorithm Summary

To summarize the procedure, given N points$({x}_{n},{y}_{n})$

- We want to interpolate with a polynomial of degree
with coefficients$N-1$ :${c}_{n}$ $y=\sum _{n=0}^{N-1}{c}_{n}{x}^{n}$ - Use GA with N basis vectors and up function:
$up(x,y)=y{e}_{N}+\sum _{n=0}^{N-1}{x}^{n}{e}_{n}$ - Build polynomial object
by wedging together N up projected points:$p$ $p=\underset{n=1}{\overset{N}{\bigwedge}}up({x}_{n},{y}_{n})$ - Extract interpolating polynomial coefficients
from${c}_{n}$ :$p$ ${c}_{n}=-\frac{{p}_{n}}{{p}_{N}}$

#### Conclusion

We started by looking at what interpolation is and we chose to use polynomials for interpolation. We then applied our knowledge from the previous section to represent polynomials in Geometric Algebra. With the wedge product we constructed an object representing the interpolating polynomial from which we could just read off the coefficients.

This process generalizes to any number of points and it uses only very simple GA operations, so it might be preferable over the usual methods like using matrices or Lagrange polynomials. While we were focusing on polynomials here, this process works identically with other functions too, as no assumptions about the basis functions were made. The only change is to use a different up function.

#### Next: Design of Geometric Algebras - Tangent Objects

#### Bonus: Different basis functions

Below I tried some different basis functions for the same three points and five points.

##### Three points

$up(x,y)={e}_{0}+x{e}_{1}+{x}^{2}{e}_{2}+y{e}_{3}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{cos}(x){e}_{2}+y{e}_{3}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{sin}(2x){e}_{2}+y{e}_{3}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+{2}^{x}{e}_{1}+{3}^{x}{e}_{2}+y{e}_{3}$

_{Link to CoffeeShop with code}

$up(x,y)=\mathrm{sin}(y){e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{cos}(x){e}_{2}+\mathrm{sin}(x\ast y){e}_{3}$

_{Link to CoffeeShop with code}

##### Five points

$up(x,y)={e}_{0}+x{e}_{1}+{x}^{2}{e}_{2}+{x}^{3}{e}_{3}+{x}^{4}{e}_{4}+y{e}_{5}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{cos}(x){e}_{2}+\mathrm{sin}(2x){e}_{3}+\mathrm{cos}(2x){e}_{4}+y{e}_{5}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{sin}(2x){e}_{2}+\mathrm{sin}(3x){e}_{3}+\mathrm{sin}(4x){e}_{4}+y{e}_{5}$

_{Link to CoffeeShop with code}

$up(x,y)={e}_{0}+{2}^{x}{e}_{1}+{3}^{x}{e}_{2}+{4}^{x}{e}_{3}+{5}^{x}{e}_{4}+y{e}_{5}$

_{Link to CoffeeShop with code}

$up(x,y)=x{e}_{0}+\mathrm{sin}(x){e}_{1}+\mathrm{cos}(x){e}_{2}+\mathrm{sin}(y){e}_{3}+\mathrm{cos}(y){e}_{4}+y{e}_{5}$

_{Link to CoffeeShop with code}