Archive for the ‘Fun’ Category:

The Mona Lisa As Drawn By A Traveling Salesman

Posted In: Fun | Math
Mona Lisa TSP

The traveling salesman problem (TSP) is a classic problem in operations research and mathematical programming. It seeks to answer the question, given a set of destinations, what is the shortest possible travel route someone could take to visit them all. It is a notoriously challenging problem to solve when the number of destinations grows. A picture of the famous Mona Lisa was converted to 100,000 dots and a challenge was created to find the most optimal solution to visiting each of these 100 thousand points (i.e. drawing the shortest continuous line that goes through each and every point.
The current most-optimal solution that has been found to this Mona Lisa challenge was calculated in 2009 by Yuichi Nagata. This art is created using the order of destinations (also called the “tour) that he developed.

Click the “Draw Mona Lisa” button below to see the famous painting drawn with a single continuous line with 100,000 segments.

Each time you click on the “Draw Mona Lisa” button, it chooses a different starting point but follows the same order of destination points, looping around until all the points are visited.

You can also change the speed at which the individual line segments are drawn. It is surprisingly relaxing and satisfying to watch the line wind its way around the screen to fill in the famous picture of the Mona Lisa.

For a very high res version of the entire photo click here (around 4 MB file size).

Data and Tools:
I downloaded the 100,000 points and optimal tour from Yuichi Nagata from the TSP Art website and the University of Waterloo.
Javascript was used to draw on the HTML canvas and animate the process.

mona lisa tsp

Planetary Art – Inner Planet Orbital Spirograph

Posted In: Fun

Earlier, I had made a visualization showing that Mercury is the closest planet to Earth (on average) and not Venus or Mars. To make that, I downloaded a bunch of NASA ephemeris (orbital) data. I realized I could use the same data to make some cool orbital art inspired by a spirograph – a planetary spirograph.

Basically, you get to choose a planet and the visualization will draw a line connecting that planet and Earth every few days. These lines will then build up into a cool pattern over 40 earth years of orbital cycles. Each planet (Mercury, Venus and Mars) has a different orbital period around the sun than Earth does and as a result, interesting patterns emerges.

Orbital periods of the four inner rocky planets:

  • Mercury: 88 days
  • Venus: 225 days
  • Earth:365 days
  • Mars: 687 days

Also evident is that the orbits of some of the planets are not quite circular so the pattern isn’t quite centered on the sun. Venus has the most regular pattern, creating a distinctive 5-lobed design. The other planets also have visually stunning patterns, though they do not repeat perfectly over time.

You can change the planets using the drop down menu as well as change the speed of the spirograph, and hide the planets and the sun.

Data and Tools:
I had thought about simulating the planets but there are plenty of tools out there that generate this orbital data so instead just downloaded 40 years of ephemeris data (data related to positions of astronomical bodies) from NASA website.. I processed the data using javascript and drew the picture using HTML canvas tools.

Planetary Art Spirograph

Rubik’s Cube World Records for 3×3 Puzzles (Regular, feet, blindfolded, one-handed)

Posted In: Fun

I recently taught my daughter how to solve the rubik’s cube using “the beginner method”. She’s getting decently fast, but when we watched some youtube videos about really fast speed cubers, we were blown away by how fast people can solve the cube. The world record time is under 4 seconds! I thought it’d be fun to document the progression of world records since the cube was introduced in 1980.

What was interesting in looking through the records are the strange events that people compete in and post amazing times in. Blindfolded! With Feet! One-handed! Feet or one-handed is at least in the realm of possibility, though it would slow down my already slow solves, but blindfolded is next-level stuff.

Hover over the different data series for the events to see the record-holder’s name, country, solve time and competition for each world record. You can also toggle the y-axis scale from linear to log scale in order to distinguish between the latest world records as they tend to converge and have very small changes.

Not sure if it’s motivating or discouraging to see these ridiculously fast solve times. Knowing that we’ll never be able to beat people who solve the cube blindfolded is a bit humbling.

Data and Tools:
Data was downloaded from, a speed cubing website and the data was plotted using the open-sourced javascript engine.

rubik's cube world record times

Antipodes map: What’s on the other side of the Earth?

Posted In: Fun | Maps

What is an antipode?

An antipode is a point that is on the exact opposite side of the earth (or other sphere) from a given location. If you drew a line (vector) from your location to the center of the earth and continued that line until it emerged from the other side of the earth’s surface, that point of intersection on the other side is the antipode. When I was a kid, people occasionally mentioned “digging a hole to China”. While this is currently impossible for many reasons1Earth’s core is about 6000 degrees C, China is not the antipode for North America (where I grew up). If you grew up in Argentina or Chile, then maybe that would make a little more sense.

The antipodes for most of North America and Europe are in the Indian and South Pacific oceans respectively.

Other examples of antipodes that are both on land:


It should be relatively explanatory, but you find your location by dragging the globe on the left side so that your location is in the center crosshair. The other globe (on the right) will show you the antipode to your location.
You can zoom in and out with the +/- buttons or pinch to zoom on mobile. If you zoom in enough, it will look like a normal two-dimensional web map (like google maps).

This interactive visualization is made using the awesome webglearth javascript library. I just discovered this recently after making a number of 2D maps.

Footnotes   [ + ]

1. Earth’s core is about 6000 degrees C

¿Cuánto tardarías en contar hasta un millón?

Posted In: Counting | Fun | Math

Disculpe(n) mi pobre español. Utilicé google translate para escribir esto en español.
Aquí está la calculadora que calculará cuánto tiempo lleva contar un millón (o números mayores) en español.

Interactive Dot Illusion (Individual Linear Motion Yields Circular Motion)

Posted In: Fun

This post doesn’t really involve data, but I was just messing around with animation and the canvas in Javascript and decided to make this. It’s a fun little interactive web animation that makes aggregate circular motion from a bunch of dots moving in straight lines. There are no real instructions except to mess with the controls and see what it does to the animation (i.e. change the number of dots, the speed slider, the dot colors, and show the dot paths).