# How to visualize a 3D slice of a higher-dimensional space

A few months ago, I read a book called The Elegant Universe and in it the author discusses Calabi-Yau manifolds and includes a plot that is a 2D slice of a Calabi-Yau manifold. Does anyone know how to go about taking a 2D or 3D slice of a 4D (or higher) manifold and visualizing it? For example, in the Wikipedia link they provide this image which is a 2D slice of a 6D Calabi-Yau manifold:

How could one recreate this or, even better, create a 3D version?

I think that what you are calling slices are in fact projections of the real representation of a Calabi Yau manifold, as a complex manifold, onto euclidian spaces of lower dimension. Example:
z_1^n+z_2^n=1, n positive integer

This manifold consists in n^2 â€śsubmanifoldsâ€ť represented by:
z_1=e^{2\pi i j/n}\cos(x+iy), j =0:n-1,
z_2=e^{2\pi i k/n}\sin(x+iy), k=0:n-1.
A 4D \mathbb{R}-vector (real(z_1), real(z_2, imag(z_1), imag(z_2)) can be projected onto the 3d space in various modes.

For example projection to:

1. (real(z_1), real(z_2), imag(z_1)) and coloring the corresponding surface according to the values of imag(z_2)
2. (real(z_1), real(z_2, imag(z_1)*cos(a)+imag(z_2)*sin(a)) where a is an arbitrary angle; Here (imag(z_1), imag(z_2)) is projected onto the direction (cos(a), sin(a))
etc, etc.

I illustrate these two cases with a PlotlyJS code, that can be adapted to be plotted with another plotting library:

using PlotlyJS

function calabi_yau(z::T, n::S, j::S, k::S) where {T<:Complex, S<:Integer}
#z=x+1im y
z1 = cis(2Ď€*j/n) * cos(z)^(2/n)
z2 = cis(2Ď€*k/n) * sin(z)^(2/n)
return [real(z1), real(z2), imag(z1), imag(z2)]
end

x = range(0, Ď€/2, length=8)
y = range(-Ď€/2, Ď€/2, length=16)
z = [s for t in y, s in x] .+ 1im*[t for t in y, s in x];
surfs = GenericTrace{Dict{Symbol, Any}}[]
n=3
for (j, k) in Iterators.product(0:n-1, 0:n-1)
xyzu = calabi_yau.(z, n, j, k; )

push!(surfs, surface(x=getindex.(xyzu,1), y=getindex.(xyzu,2),
z=getindex.(xyzu,3), surfacecolor=getindex.(xyzu,4),
coloraxis="coloraxis"))
#or push!(surfs, surface(x=getindex.(xyzu,1), y=getindex.(xyzu,2),
#                         z=getindex.(xyzu,3) * cos(Ď€/6) .+ getindex.(xyzu,4) * sin(Ď€/6),
#                         coloraxis="coloraxis"))
end
pl=Plot(surfs, Layout(width=600, height=600, font_size=11,
coloraxis=attr(colorscale=colors.plasma,
colorbar_thickness=24, colorbar_len=0.7),
scene_camera_eye=attr(x=1.8, y=1.8, z=1)))


In your posted image each subsurface is colored with a distinct color. Here I used a colorscheme for the global surface.

7 Likes