Scalar multiplication and vector addition with hyperbolic vectors

geometryhyperbolic-functionshyperbolic-geometrynoneuclidean-geometry

I'm representing hyperbolic vectors using the Minowski hyperboloid: $x_0^2 – x_1^2 – x_2^2 = 1$.

I understand that the distance between two hyperbolic vectors of this form is $acosh(B(u, v))$ where $B(u, v) = u_0v_0 – u_1v_1 – u_2v_2$.

But I cannot for the life of me figure out a simple way to perform scalar and vector multiplication with the expected results using these vectors.

For scalar multiplication, for example, I have tried the following:

For one dimensional hyperbolic vectors ($1=x_0^2-x_1^2$), I have understood that scalar multiplication is equivalent to multiplying the hyperbolic angle. If $v = [cosh \theta, sinh\theta]$, then $2v$ should be $[cosh2\theta, sinh2\theta]$. Finding $\theta$ should be as trivial as taking $acos(x_0$).

Things get complicated in 2d hyperbolic space. I have toyed around with the idea of finding the angle of rotation on the "z" axis ($x_0$), and rotating that back, so that the value of $x_2$ is 0. Then applying the above function, and then rotating it back to its original state.

However the computational cost of that is immense, and it's prone to rounding error. There must be a simpler way?

I have not even begun to understand how vector addition and subtraction would work in such a space.

The wikipedia page seems to be lacking on this topic.

And please, ELI5. I have no strong math or geometry background. I am a programmer.

Note: I am storing these values using the Minowski model, rather than the Poincaré disk, as the Poincaré disk is extraordinarily prone to rounding errors on large vectors.

Edit: I have found a (still inefficient) way to do the scalar multiplication. It is nearly exactly as described above: convert the coordinates into "polar form," with a hyperbolic angle and an angle in the "z" axis. Then multiply the hyperbolic angle, then convert back. As suspected though, it does cause rounding errors.

Best Answer

The problem is that things like scalar multiplication and vector addition/subtraction are not well defined in hyperbolic geometry -- you could invent some definition, but then they will not have the same properties as in Euclidean, so it is probably better to avoid such operations, or call them something else. What do you need "scalar multiplication" for?

I sometimes use scalar multiplication and vector addition/subtraction which act in the whole Minkowski space (not restricted to the hyperboloid), i.e., $(x_a,y_a,z_a)+(x_b,y_b,z_b) = (x_a+x_b, y_a+y_b,z_a+z_b)$. These operations are well defined and they have some uses, for example, to find a midpoint of $(A,B)$, you add the coordinates and project the result back to the hyperboloid.

I think the rounding errors are unavoidable if you are working with hyperbolic geometry extensively. The main reason is that the hyperbolic plane grows exponentially -- a circle of radius 200 will have area of roughly $e^{200}$, so even if you are using the Minkowski hyperboloid model with three 64-bit coordinates, you have only $2^{192}$ representable points. If you have, say, two creatures starting in a small distance $\epsilon$ and going in a roughly parallel direction, the distance between them will grow to roughly $\epsilon e^d$ after each of them moves $d$ units. Likewise, the $\epsilon$ could be caused by floating point errors, so floating point errors will blow up in cases similar to this. In HyperRogue, the matrices such as the view transformation naturally accumulate floating point errors, eventually the errors build up so much that the matrix does not make any sense anymore. To fix this, the transformations are "fixed" from time to time -- this operation transforms the given matrix to a nearby isometry, losing any built up errors.

You can see our implementation of hyperbolic geometry here: GitHub (it is a bit more complex because it works with Euclidean and spherical geometry too; also, points outside of the hyperboloid are used to represent the 3D hyperbolic space in a rather weird way). Not everything is optimal in terms of computational cost, but it works good enough for HyperRogue. (The main ideas are roughly described here.) For things you would use vector addition/subtraction in Euclidean geometry, HyperRogue generally uses functions "find a matrix which rotates the given point to the x axis" or "find a matrix which translates along the x axis to move the given point to 0", which are indeed rather inefficient. But IIRC the basic things like tiling generation do not need such operations, these are more useful for complex things like movement animations. No operation similar to scalar multiplication is used -- instead there is xpush(d) which translates $d$ unit along the $X$ axis, so instead of trying to multiply a vector by a scalar, you would say what direction and distance you want, and apply the rotation and xpush(d).

Related Question