Here is an interactive visualization of Calabi-Yau manifolds as Fermat hypersurfaces, rendered using Three.js and presented with MathCell:

The figure can be rotated by clicking and dragging with a mouse or swiping on a touch device, as well as zoomed in or out with a mouse wheel or pinching on a touch device. The integers on the buttons determine the degree of the underlying equation defining the surface.

The interactive graphic is a JavaScript implementation of the techniques described in this online reference, apart from the color coding:

The method of visualization boils down to three-dimensional projections of a surface in four dimensions defined by the equation

$z1n +z2n =1$

with two complex variables and an arbitrary integer n as exponent. This equation is identically solved by the coordinate combinations

$z1=e iφ1 [cos(x+iy) ]2/n z2=e iφ2 [sin(x+iy) ]2/n$

where the phase factors are nth roots of unity with

$φ1 =2π k1n , 0≤k1

The nth powers of the phase factors are exponentials of multiples of 2πi , hence unity.

The real and imaginary parts of z1 and z2, a total of four variables, parametrize a surface in four dimensions. The surface presented above consists of the coordinate triples

$[Rez1, Rez2, Imz1cosa +Imz2sina ]$

where the third coordinate is a linear superposition of the imaginary parts of the complex variables. This is an orthogonal projection in which the fourth coordinate, the linearly independent combination

$Imz1sina -Imz2cosa$

is simply ignored. The same process produces two-dimensional shadows from three-dimensional objects when the sun is directly overhead.

Since JavaScript does not support complex numbers natively, numerical evaluations are performed with Math, a library providing special functions in the browser. While it is possible to convert the complex expressions to pure real ones by hand, the expressions are somewhat cumbersome. A library that handles complex math is by far more convenient.

The color coding in this graphic is chosen to provide maximum distinction around points of symmetry where patches meet. Since CSS hue values run from zero to 360, the hue of each patch is determined by

$360× k1 +k2n mod360$

One peculiarity of the coding for the surface is noteworthy: the number of steps in the y-variable must be even to avoid holes in the surface around y = 0 . This is because the description used in MathCell of a parametric surface in terms of slices and stacks always has one more vertex in each direction than these two numbers, so that keeping the number of steps even ensures that the origin of the y-variable is included. For both parametrization variables small numbers of steps are used to reduce browser load and defects from z-fighting.

With color coding enabled, there is still some noticeable z-fighting among portions of the surface close to one another. There does not appear to be a simple way to avoid this without introducing artificial distortions into the surface, but that would be less desirable than the z-fighting distraction.

One simple extension fixes projection angles and renders the graphic as a wireframe:

Look familiar? If not, check out this Calabi-Yau manifold by the artist Bathsheba.

Uploaded 2017.11.13 — Updated 2017.11.25 analyticphysics.com