Algorithmic Mathematical Art

By Xah Lee. Date: . Last updated: .

Here is an introduction and survey of Algorithmic Mathematical Art.

In the early 1990s, they were merely visualization aids in the study of mathematics. Gradually, the complexity and artistry of the images becomes an end itself.

Here, i examine the various methods of algorithmic mathematical art, and indicate the states of the art and possibilities. At the end, i give a definition of Algorithmic Mathematical Art.

Geometric Surfaces

math borg cube 2021-07-27
Borg cube
 max = 5; ContourPlot3D[ Sin[x*y] + Sin[y*z] + Sin[z*x] == 0, {x, -max, max}, {y, -max, max}, {z, -max, max}, Boxed -> False, Axes -> False, Mesh -> None, ContourStyle -> Directive[RandomColor[], Opacity[0.5], Specularity[ 1, 20]]]
Riemann Surface. (source: from Richard Palais)

Plots of arbitrary 3D surfaces for visual arts purposes has not been explored much. The exception is visualization of some special mathematical surfaces, especially in differential geometry. (for example: minimal surfaces at .)

As of today, it is scarcely known how surfaces look like of arbitrary equations of 3 variables. Equations with more than 3 variables can be projected or sliced to 3 dimensional space, and this is completely unexplored.

Regular Solids of 3 or more dimensions

linked ring dodecahedron
A dodecahedron formed by pentagonal rings, by Michael Trott of Wolfram Research.

In 2 dimensions we have regular polygons, such as square and pentagon and hexagon. The 3-dimensional version is called regular polyhedron. For example: cube, octahedron, icosahedron. The general name for such objects in any dimension is called polytope.

Polyhedrons as artistic themes have been explored greatly, way back in the Greek times and in different cultures, often exhibited as toys, sculptures, paper models (origami), or hanging decoration. In modern times, polyhedrons have been exhibited as architecture element as well. (Examples: the Disney's geodesic dome, Eden Project hemi-spheres, Atomium )

uniform polyhedra by Robert Webb
Paper models uniform polyhedra by Robert Webb. [image source ]
A Islamic lamp in the shape of a stellated polyhedron. (at the entrance of Aladdin hotel resort in Las Vegas, 2013).

Computer models as visual arts have been very popular. However, most of them are direct rendering of the mathematical object with almost no artistic value. Commonly seen are polyhedrons rendered with latest ray-tracing computer graphics advances, with some stellation or truncation. Highly artist algorithmic exploration of polytopes is almost non-existent. The image by Michael Trott above, of a dodecahedron rendered as linked pentagonal rings, is a basic artistic exploration.

For some examples of artistic algorithmic exploration, one can systematically examine ways to render a space by linked rings. For the centrally symmetric dodacahedron, for example, by some cleverness in linking, the links can extend to infinity as to fill the whole space with these links, and a cut-away view can be made to result in a artistic image. Or, polygonal tubes can be made to have larger radius, so that each polygonal “side” of the tube is a large flat area that a Maze can be incribed upon. The number of sides of the ring can increase or decrease according to certain parameters, such as symmetry location or distance from origin. Or, one can use spheres instead of rings. The coloring of balls around the dodecahedron can be exploited systematically, so to result in different symmetry groups of different groups of balls. Imagine a 3-D space with a cluster of differently colored balls that exhibits subtly different symmetry groups as in an elaborate intricate tiling work. Or, imagine 3-D space tiled uniformly by regular polyhedrons, with some walls open, as to form a 3-dimensional maze. If well done, a cut-away view or translucent view of this would be fantastic. A walk-thru as implemented in video games also has great potential. Solid stacks of cubes is called Polycube (a 3-dimensional version of polymino). Solid block sculptures with other regular polyhedron are basically unexplored. Block of connected tetrahedron are particularly interesting.

Below are some examples of polytopes:

Plane Curves

fiery sine fw3cf
plots of the equation
ContourPlot[ Sin[x*Sin[y]] - Cos[y*Cos[x]] == 0, {x, -10, 20}, {y, -10, 20}, PlotPoints -> 50, ColorFunction -> Hue]
“fiery”, density plot
A density plot version. Math: Density Plots of Trig Expressions

Two-dimensional plots for visual art purposes have not been explored much. Algebraic curves of more than 4 degrees are almost unexplored. One could create a program that systematically generates and plots all possible equations by degree or type, including non-algebraic ones.

Almost all ornamental elements in architecture or interior decorations are based in geometry, and most of them based on curves. Examples of curve based traditional art include: dome, arch, vault (based on arcs of circle), volutes (as scrolls on columns or violins) (based on various spirals), curlicue (based on Cornu spiral, lituus), toy Spirograph (based on roses, cycloidal curves).

Methods of artwork based on curves can include: tangents, envelope, caustics (String art); osculating circles and inversion, evolute/involute, pedal curves, parallel curves, pursuit curves.

Plane Geometry and Processes

cir invt filigree
Nested inversion of circles. Nested circles can result in many esthetic images.
sphere proj
Stereographic projection of a circles on a sphere to the plane. (produced by software KriviznaPlus at by Viktor Massalogin).
nested circle inversion 74509
Nested inversion of circles. [source, original in PostScript at by William Gilbert. JavaScript version by bitcraft lab [2016-12-30 ] at . (local copy Nested Circles Inversion ) ]
Circles generated by Mobius transform, by Ed Pegg Jr. [image source 2004-03-15 Math Games column]

Traditional artworks based on geometric process include that of circles of tangency ( Appollonius circles ), various plane transformations applied to a grid or regular tilings (linear, affine, projective, geometric inversion, mobiüs transformation, stereographic projection…). A particular example in recreation is anamorphosis, which is a drawing that is not recognizable until its reflection is viewed on a shiny cylinder or metal ball. (See: artwork “Trash Reflection”)

A wallpaper pattern with star motif, cut into a diamond outline, then a fish-eye lens transformation is applied.

For some images of traditional geometric processes, see:

L-Systems, Turtle Graphics

mushroom triangle fractal
“mushroom triangle”, generated by recursive line-replacement
snowflake fractal
A snowflake generated by recursive line-replacement. (from An eye for Fractals, Michael McGuire. 1991. p.16.)
pinwheel tiling
A “Pinwheel tiling”: recursive dissection of a right triangle with sides 1, 2*Sqrt[5].
Federation Square, Melbourne, Australia.

L-System is a recursive symbol-sequence replacement system originally devised to model plant growth. It is often used to generate self-similar images by interpreting the symbol-sequence as drawing commands or geometric objects. Turtle Graphics is from the programing language Logo, which algorithmically controls the movement of a pen, by specifying directions and pen down or up.

L-System and Turtle Graphics have been somewhat popular among recreational programers. However, there have not been serious studies of visual art possibilities with these methods. Commonly found are illustration of famous plane-filling curves in mathematics, plant-growth modeling, or simplistic symmetric drawings for children as a demo of Logo. Few of them are ingenious.

[Two-dimensional L-systems By Robert M Dickau. At , accessed on 2013-10-08 ]

Plotting of Functions and Processes

Many functions in mathematics can be visualized as a plot. For curves and surfaces, the plotting scheme is simple. Often just on a 2D grid or 3D grid, with marked axes as coordinate. For other functions, such as vector valued functions, complex valued functions, mathematicians have developed other schemes to visualize these functions. Here are some examples.

Discriminant real part
“The real part of the discriminant as a function of the nome q on the unit disk”, by Linas Vepstas, 2005. [image source ]
arg princ1
A plot of the complex-valued function (z-2)^2(z+1-2*i)(z+2+2*i)/z^3. By Hans Lundmark, 2004. [image source]

Tilings and Patterns

Crossbw2 Celtic knots strip
A traditional Celtic pattern (by Alastair Luke) The colorings are added on to make it easy to trace. In fact, the whole central cross with its round endings is of one single string. I just used different colors for different segments because otherwise it's one single color.

The main attraction of Celtic knot patterns is their geometric design, but the topological aspect (the “knot”) is also interesting mathematically. One can survey traditional designs to see whether they are really knots, or braids of how many strands, and how they are knotted. I'm not sure this has been studied much. There is little systematic study of algorithmic knot/weaving-pattern generations. (There have been systematic mathematical studies of weavings/fabrics by B Grünbaum and G C Shephard).

57 57color coded
From “Islamic Designs for artists and craftspeople”, by Eva Wilson, 1988. The right image is colored to show the weave.
a knot design. (from a book, source?)
wickerwork pattern
A weaving pattern (Wickerwork) commonly found in Asian chairs made of rattan.
star 16 7661 sq lotus vine weaving p rb basic islamic p sq squarly weave p
Starry Wallpaper GalleryMath Tiling Gallery

There are many varieties of pattern designs by different cultures. The decorative Celtic knots and Islamic geometric tilings are particularly mathematical. Although there are great number of existing designs throughout the world and history, but with respect to mathematical or algorithmic classifications, there are not many varieties. This is not surprising when we consider that these artistic patterns are developed culturally by artisans, not as a result of mathematical analysis of plane symmetry or systematic algorithmic exploration.

For plane patterns, it is known since the last century that there are 17 types of symmetries. According to Branko Grünbaum et al [Symmetry in Moorish and Other Ornaments, Comp. and Maths. with appls., Vol. 12B, Nos. 3/4. pp. 641-653, 1986], not all types are found in Alhambra, contrary to popular belief. The mathematical understanding of tilings and patterns is relatively poor even today. It is essentially a unexplored area. The mathematical analysis of weavings is almost completely untouched. (Weaving, as the mathematical content of Celtic knots and Islamic patterns. It can be considered topologically as knots and braids, or as certain uniform lattice network with marked nodes and edges with a geometric layout.)

Penrose Tiling

Penrose tiling is a aperiodic tiling. The discovery of Penrose tiling was a break-thru in mathematics and crystallography with great ramifications (For example, material science). The beauty of aperiodic tilings is that their orderliness is subtle. Such type of beauty was not possible in the past.

2D Tiling nice
A tiling by Olaf Delgado Friedrichs.
hyperbolic tiling 2002 by hsaka
Hyperbolic tilings. [Mandara: The World of Uniform Tessellations By hsaka. At , accessed on 2011-02-23 ]
A hyperbolic semiregular tesselation. [Hyperbolic Planar Tesselations Don Hatch. At , accessed on 2011-02-23 ]

Modern math knowledge adds incredible amount of new possibilities at decorative designs. The math understanding of symmetry, and the discovery of aperiodic tilings, and also designs based on hyperbolic geometry, were all not possible before.

knot tiling
Knots in a geometric framework.

More example of tilings:

Fractals, IFS

newton basin fractal carapace
A plot of root finding algorithm. Newton fractal. [image source [Fractal Gallery By Ben Haller. At ]]
A plot of a iteration process [see Mandelbrot Set Explained].
(img src [Fractal Gallery By Ben Haller. At ])

Fractals are plots of mathematical objects. They began as a visual aid of a mathematical process. Essentially, each point in the plane is colored according to how that value (x,y) behaves when fed into a formula recursively.

Fractals, by its very nature of garishness and bizarreness, has been extremely popular among computer artists — even those who are not interested in mathematics or computer science. Fractals as a visual art have been explored extensively, and great many varieties and galleries have been created on the web.

The exploration of fractals as a visual art form has somewhat limited expression. Artistic creativity is limited to concocting equations and coloring schemes. Some people have started to mix computer generated fractals with manual manipulations, such as mixing in digitally modified photos. Such artwork ceases being algorithmic or mathematical.

See also: Mandelbrot Set Explained (no complex number needed)

Higher Dimensions

As we understand higher dimensional spaces, it opens a great gate of algorithmic art thru the process of projection or slicing of higher dimensional objects to 3-dimensional space or the plane.

Non-Euclidean geometry and higher dimensional geometry and topology are understood by only a few mathematicians in the world. (perhaps a few thousand people, or less if we are specific in the field) Consequently, artistic exploits thru their understanding are basically non-existent. Almost all ideas discussed in this page can be thought about in higher dimensions and or non-Euclidean space. In higher dimensions, there are totally new concepts that are non-existent in lower dimensions. (orientability, embedding, isotropism, etc) As math and technology march on, we may see more visual art explorations thru higher dimensions.

As a example, one idea of creating tilings and patterns is to slice thru some regular lattices of some higher-dimensional manifold. And, we may ask whether it is possible to encode some higher-dimensional manifold properties (such as orientability or the geometry it admits) by a visual exhibition. (i do not quite understand this, but for example, we can illustrate the angle-invariant property of inversion by showing the before and after images of a rectangular grid. We can also show linear and affine transformations by the way they look when applied to a grid. We can show properties of projective transformation and Conic Sections by shadowing. (think of beautiful stained glass in great Cathedrals) We can show homeomorphism or continuous transformation by animation, especially on tilings. We can color surfaces by their curvature, and draw gridlines along constant curvature lines, and show invariance of curvature such as the helicoid-catenoid surface family.

A 3D slice of a regular polytope of higher dimension. From Mark Newbold's Hyperspace Star Polytope Slicer
curved space mac
A visualization of 3-manifold. From Jeff Weeks's CurvedSpaces.

Evolutionary Programing

Evolutionary programing is a emerging method to generate visual art. The method is often done as genetic programing with human arbiter for judging the survival of the fittest. However, most of the investigations done so far over the 1990s tend to be insults to eye with the excuse of being abstract “art”. They are not mathematical.

ankos p236 b4962
A example of cellular automata. A New Kind of Science p236 [image source ]

Cellular Automata (CA) methods can also be employed for mathematical visual art. Stephen Wolfram's book A New Kind of Science, for example, contains many pleasing images of cellular automata, although not for the express purpose of visual art. For example, it is frequently cited that the patterns on sea shells are results of cellular automata. (seashell photo) This is a example of using CA for non-mathematical art. (That is, the image does not contain some inherent math structure or appeal.). However, CA probably can be exploited for mathematical art. For example, consider the great varieties of seashell shapes. (See: Math of Seashell Shapes) Some has horns, spikes, ribs. Some are long, some are flat, and there are many types of overall spiraling structure. Seashells are grown from the calcium deposits secreted by the mollusks, and over the years many different shapes emerged thru evolution. Therefore, it is conceivable that a 3-D cellular automata can be set up with genetic programing to simulate the evolutionary process, as to obtain the many shapes of seashells as pure art of mathematical spiraling surfaces.

[GeoMorph (~2002) by Harry Foundalis. (Generating surfaces with genetic programing element and manual evaluation). At ]

M C Escher

M C Escher (1898 to 1972) is a Dutch artist whose works are predominated by mathematical themes, many of which are purely algorithmic. Although, Escher is a traditional artist; his algorithmic arts are done manually, not by a program from computer, nor with a explicit algorithmic specification.

It is easy to go from algorithms to visual images, but given a algorithmic artwork, it is difficult to extract the algorithm in the form of a precise runnable program. The following two works by M C Escher illustrates this:

butterfly by M C Escher
butterfly , by M C Escher. This image is clearly purely algorithmic. However, it is not trivial to extract the algorithm involved and turn it into a working program. From a pure minimalist point of view, one should be able to start with half a image of a butterfly, and apply a algorithm recursively to get the final image. Note that the butterfly's wings are colored in such a way that mutually orthogonal circles are formed, and this must be encoded in some way into the algorithm. There are different algorithmic approaches. One can do it by describing pen paths as in Turtle Graphics, or by recursive replacement as in L-Systems. Perhaps a least interesting way is by a mapping process with some mathematical model such as hyperbolic geometry on a rotational-symmetric tiling. Once a algorithm is obtained, one should be able to apply it to various motifs, or tweak parameters to get different effects.
Whirl Pool by M C Escher
Whirlpools , by M C Escher. This image is also clearly algorithmic. It consists of a strip of a repeated motif (the fish), wrapped into a double spiral. To generate this image algorithmically, one can start with a motif, reflect and glide-reflect to get a long strip, then use a function that map the strip into a spiral, then mirror to get the other spiral. (or use a function that maps a strip into such double-spirals) Finding the function may not be easy. I imagine to get it right it might take several days tweaking it with functional programing languages such as Mathematica, Lisp, Haskell. Perhaps a more elegant but even more difficult approach is to describe it recursively, which would also deal better with singularities at the center of each spiral.
Escher's metamorphosis. This theme of aglorithmtically transforming a tiling is particular type of algorithmic mathematical art. It has been studied notably by Douglas Hofstadter.
Escher's snakes
Another Escher's algorithmic mathematica art: “Snakes”. This artwork is made by inter-linked circles of various sizes to form a weaving, in a specific geometric layout inside a circle. The snake animal drawings are mere decorations that adds spice to the artwork.

To generate this work algorithmically, one needs to encode the knot process. (i.e. when there is a intersection between 2 circles, which one goes on top.). One also needs to encode the geometric layout, namely, the circle's positions and sizes. Note that circles are smallers near the center, but also gets smaller near the edge. This size change is not linear. Also, note that the circles have 3 different colors. The coloring basically cycle thru as they are spread toward the edge. Also, each of the circle ring has a slant (a thin side), either facing the center or facing the edge.

(M C Escher's artworks are copyrighted by M.C. Escher Company B.V.)

What is Algorithmic Mathematical Art

A visual artwork is mathematical if it appeals to mathematicians and the graphics itself encodes a mathematical structure. For example, M C Escher's tiling works are mathematical art, but some of his other works such as Ants Crawling On A Mobius Strip, Illusions, Day And Night, Forever Loop Stairs, are works of art illustrating mathematical ideas, but not the mathematical art discussed here.

A visual artwork is algorithmic if it is recursive, symmetric, or embodies a mathematical equation (such as curves and surfaces). For example, M C Escher's “Butterfly” and “Whirlpools” and his tiling works are algorithmic. All illustrations in this article are algorithmic. Algorithmic art exhibits recursion or symmetry (including quasi-symmetric ones like that of Penrose Tiling ). However, artwork generated by computer programs are not necessarily algorithmic. For example, ray-traced computer generated sceneries, or digitally retouched fractal artworks, are not considered algorithmic, in our context.

The Algorithm in Algorithmic Mathematical Artwork

Algorithmic artwork might not be generated by a computer program. M C Escher's artwork are examples of algorithmic artwork not generated by computer programs. Computer generated algorithmic artworks might not be generated algorithmically either. Here, “algorithmically generated” means a program that distills the inherent algorithmic nature in a artwork. For example, many tilings and patterns artwork today are spitted out by computer programs, but the programs are written in a ad hoc, case-by-case basis, consisting of drawing commands tweaked to match a desired output. Although generated by a program, but the essence of creation is manual. What we really want are programs in a form that embody, capture, or distill the algorithmic nature of the artwork, as a executable specification by means of recursion or symmetry code. The beauty of algorithmic artwork lies in its inherent beauty of algorithmic pattern or symmetry, and its creation process should be done that way. When this is achieved, and its algorithmic essence is captured, and we can then create vast numbers of variations by changing parameters or input. (This does not imply that results will be similar, as we know from chaos theory.). Generating a algorithmic mathematical art by a algorithmic process can be likened to specifying a Sequence by Recursion , or a group by generators and relations , or modeling a physical phenomen by a equation or cellular automata. It is a pursuit of elegance that captures essence, and gives us a precise insight on relations.

Related Websites and References

Here are some list of people i know who are doing algorithmic art, mathematical art, or whose artwork are heavily math related:

The following is a annotated list of books that have influenced my outlook one way or another.

Books on Islamic geometric patterns.

Xah Talk Show 2021-04-12 Wolfram Language, and What is Algorithmic Mathematical Art

Math and Illustrations