## Mathematica

During my time in graduate school, I learned to make mathematical illustrations in Mathematica mostly by trial, error, and incremental improvement. Here is a selection of programs I wrote showcasing different features (tweaking surface properties so things look nice, setting up animation timing, computing group elements from generating sets, etc) that others may find useful. Every notebook has (unexecuted) examples spread throughout: execute all commands sequentially when reading through, and test images will appear. ### Cubic Surfaces: ContourPlot3D

Mathematica programs written to draw the real lines on a cubic surface, and more generally algebraic hypersurfaces of $\mathbb{P}^3$. Code originally developed to help Stephen McKean, Daniel Minahan, Tianyi Zhang illustrate the paper https://arxiv.org/abs/2002.10367. This file illustrates a bunch of useful options for ContourPlot3D to make graphics look more professional. ### Elliptic Fibrations: Rendering Videos

This program shares a beginning with the above (all images are based on ContourPlot3D) - but is included for anyone who wants an example of creating a video in mathematica. It has sections for moving the camera, makign smooth animation timing functions, updating the frame, rendering in parallel, and outputting a sequence of frames to a folder. ### Fibrations of S3: Parametric Curves & Tubes

The Hopf and Seifert fibrations of $\mathbb{S}^3$ fill the sphere with linked circles and torus knots. This program visualizes these through stereographic projection. Some useful tricks are drawing tubes around curves (without parameterizing the tube as a surface), and controlling the width of these tubes. ### Flat Tori in the 3-Sphere: Parametric Surfaces

This program takes as input a curve on $\mathbb{S}^2$ and draws the surface in $\mathbb{S}^3$ which is its preimage under the Hopf map. This generalizes easily to drawing surfaces in ruled by the fibers of the Seifert fibrations as well, and is useful in constructing flat tori. This program illustrates the ParametricPlot3D commands needed to make nice looking graphics. ### 4-Polytopes

In four dimensions, there are six regular polytopes: five higher-dimensional analogs of the platonic solids, and the 24 cell. Interpreted as regular tilings of the three-sphere, this program allows the visualization of these through both stereographic and perspective projection into $\mathbb{R}^3$. ### Klein Model of $\mathbb{H}^2$: Graphics[]

The hyperboloid of two sheets, realized as the sphere of radius -1 in Minkowski space, inherits a metric of constant curvature -1. This program utilizes this to draw hyperbolic tilings in the Klein model, the projectivization of the hyperboloid onto an affine patch in $\mathbb{R}\mathsf{P}^2$. This program illustrates techniques for making 2D graphics in mathematica using the Graphics[] commands, as well as some computational stuff (how to compute many elements of a group given its generators, for instance). ### Poincare Model of $\mathbb{H}^2$: Graphics[]

The Poincare disk is a model of hyperbolic geometry built within the complex projective space $\mathbb{C}\mathsf{P}^1$. This program draws hyperbolic tilings in the Poincare disk, computing geodesics from their endpoints on the boundary by finding the unique orthogonal circle. This illustrates many of the same techniques as the previous program, but is more complex due to the semicircular nature of Poincare disk geodesics. ### Convex Real Projective Triangle Groups

Tilings of $\mathbb{H}^2$ by triangles are rigid, but deform nontrivially into real projective geometry. This program animates the 1-parameter family of deformations of the $(p,q,r)$ reflection group, following Anton Lukyanenko's master's thesis, available here. This again illustrates working with Graphics[], in a setting maybe not as familiar as hyperbolic geometry. ### Complex Function Plots

The graph of a complex function is a subset of $\mathbb{C}^2$, and so it is often easier to think about these objects via domain coloring, or coloring a point $z\in\mathbb{C}$ using its image data $f(z)$. This program takes as input arbitrarly complex functions and draws the associated domain coloring of a pre-specified region in $\mathbb{C}$. ### Boundary Slopes Knot Complements

This program takes a paramreterized knot in $\mathbb{R}^3$ and does the curves-and-surfaces differential geometry to parameterize a normal tube about it, for the purpose of drawing boundary slopes $p\mathsf{meridian}+q\mathsf{longitude}$. This parameterization is then placed in the 3-sphere via inverse stereographic projection and rotated, to embed the knot complement in $\mathbb{R}^3$.

## Javascript

I am currently trying to broaden my illustration skills by learning Javascript - specifically Threejs. Follow along here for a collection of programs of (hopefully) increasing complexity!

### Family of Dini Surfaces

This is a test program for making animated paramererized surfaces in javascript. Dini's surface is an isometric embedding of a horoball in $\mathbb{H}^2$ into $\mathbb{R}^3$; this program renders a 1-parameter family of such surfaces as they collapse onto a pseudosphere.

## GLSL Shaders

Shaders compute images pixel by pixel, in parallel on the GPU. I was introduced to this style of programming for the purpose of raytracing in Riemannian 3-manifolds; for this collection of work see our page 3-dimensional.space. The programs below are simpler examples showing a couple of techniques for 3D graphics I find useful: mostly various use cases of raytracing, and volumetric rendering. All examples run live in the browser if you click "play" on the picture, and the source code is available (and editable!) via shadertoy.com

### Computing a function of 2 variables

A simple example of plotting a real valued function of two variables via a shader. The original function comes from looking at the pushforward of the volume measure from a tangent space to $\mathbb{S}^2\times\mathbb{E}$, but you may replace this with any 2-D function you like.

### Volumetric Raytracing

This shader illustrates a real valued function on the tangent space to various geometries, computing the distortion of the volume measure under the exponential map. The picture is rendered via volumetric rayrtracing, where the color of each pixel is determined by shooting a ray out into the scene and integrating the function over its length.

### Volumetric Raytracing 2: Hydrogen Orbitals

A more involved example featuring the same techique of volumertric raytracing from above, applied to visualizing a probability distribution in $\mathbb{R}^3$: an atomic orbital.

### Raytracing in Nil Geometry

Raytracing the $xy$ plane in $\mathbb{R}^3$ with the Nil metric. This code gives a simple example of tracing where the geodesics are explicitly known, but the distance to objects are not.

### Transition from Euclidean to Nil

Raytracing the $xy$ plane in $\mathbb{R}^3$ as the Euclidean metric is smoothly deformed to Nil. This code gives a simple example of tracing where the geodesics vary in time / with a parameter.

### Raytracing the Schwarzschild Metric

This example raytraces the lightlike geodesics of the Schwarzschild metric around a black hole in front of a checkerboard wall. (Because this solution is static, the geodesic equations can be calculated via numerically solving a system of ODEs on $\mathbb{R}^3$, projecting off the time direction). This provides a simple example of raytracing where the explicit geodesics are not known.