latest news

Distractions and amusements, with a sandwich and coffee.

Where am I supposed to go? Where was I supposed to know?
•
• get lost in questions
• more quotes

The never-repeating digits of `\pi` can be approximated by `22/7 = 3.142857`

to within 0.04%. These pages artistically and mathematically explore rational approximations to `\pi`. This 22/7 ratio is celebrated each year on July 22nd. If you like hand waving or back-of-envelope mathematics, this day is for you: `\pi` approximation day!

Want more math + art? Discover the Accidental Similarity Number. Find humor in my poster of the first 2,000 4s of `\pi`.

There are two kinds of `\pi` Approximation Day posters.

The first uses the Archimedean spiral for its design, which I've used before for other numerical art. The second packs warped circles, whose ratio of circumference to average diameter is `22/7` into what I call `\pi`-approximate circular packing.

As you probably know, the ratio of the circumference of a circle to its diameter is `\pi`. $$ C / d = \pi $$

For `\pi` approximation day, let's ask what would happen if $$ C / d = 22/7 $$

where now `C` is the circumference of some shape other than a circle. What could this shape be?

A good place to start is to think about an ellipse. I've done this before in the 22/7 Universe article, in which I considered an ellipse with a major axis of `r+\delta` and a minor axis of `r` and solved for `\delta` such that the circumference of the ellipse divided by `2 r` would be `22/7`. Doing so means numerically solving the equation $$ \frac{C(r,r+\delta)}{2r} = 22/7 $$

where `r + \delta` is the major axis, `r` is the minor axis and `C(r,r+\delta)` is the circumference of the ellipse. Substituting the expression for the circumference, $$ 4(r+\delta) \int_0^{\pi/2} \sqrt { 1 - \left(1-\frac{r}{(r+\delta)^2}\right)\sin^2 \theta } d \theta = 2 r \frac{22}{7}$$

If we set `r=1` and solve it turns out that only a very minor deformation is required and `\delta = 0.0008`. You can verify this at Wolfram Alpha.

I wanted to make some art based on the shape of the this ellipse, but a deformation of 0.08% is not perceptible. So I came up with a slightly different approach to how I define the original circumference-to-diameter ratio.

Instead of treating the diameter as `r` and using `r + \delta` as the major axis, I now define the diameter as twice the average radius, or `2r + \delta`. This means that the equation to solve is $$ \frac{C(r,r+\delta)}{2r+\delta} = 22/7 $$

As before, setting `r=1` and substituting the expression for the circumference of an ellipse, we get $$ 4(1+\delta) \int_0^{\pi/2} \sqrt { 1 - \left(1-\frac{1}{(1+\delta)^2}\right)\sin^2 \theta } d \theta = (2+\delta) \frac{22}{7}$$

and solving this for `\delta` find $$ \delta = 0.083599769... $$

You can verify this at Wolfram Alpha.

This is a more useable approach since an 8% warping of a circle can be easily perceived.

Below is matrix of perfect circles along side the 8% deformed circles.

The art posters are based on a packing of these deformed circles.

By superimposing perfect circles on the warped circles, fun patterns appear.

If you pack perfect circles perfectly, the area occupied by the circles is `\pi/4 = 78.5%`.

What is the area occupied by perfect packing of warped and randomly rotated (like in the posters) circles?

To motivate choice of colors, I chose images with a 1970's feel.

Using my color summarizer, I analyzed each image for its representative colors. Using these colors and their proportions, I colored the perfect and warped circles.

For each poster of these color schemes, two poster versions are available. In one, the perfect cirlces are shown with warped circles as a clip mask. In the other, warped circles are shown, clipped by perfect circles.

Just in time for the season, I've simulated a snow-pile of snowflakes based on the Gravner-Griffeath model.

Gravner, J. & Griffeath, D. (2007) Modeling Snow Crystal Growth II: A mesoscopic lattice map with plausible dynamics.

My illustration of the location of genes in the human genome that are implicated in disease appears in The Objects that Power the Global Economy, a book by Quartz.

We introduce two common ensemble methods: bagging and random forests. Both of these methods repeat a statistical analysis on a bootstrap sample to improve the accuracy of the predictor. Our column shows these methods as applied to Classification and Regression Trees.

For example, we can sample the space of values more finely when using bagging with regression trees because each sample has potentially different boundaries at which the tree splits.

Random forests generate a large number of trees by not only generating bootstrap samples but also randomly choosing which predictor variables are considered at each split in the tree.

Krzywinski, M. & Altman, N. (2017) Points of Significance: Ensemble methods: bagging and random forests. *Nature Methods* **14**:933–934.

Krzywinski, M. & Altman, N. (2017) Points of Significance: Classification and regression trees. *Nature Methods* **14**:757–758.

Decision trees classify data by splitting it along the predictor axes into partitions with homogeneous values of the dependent variable. Unlike logistic or linear regression, CART does not develop a prediction equation. Instead, data are predicted by a series of binary decisions based on the boundaries of the splits. Decision trees are very effective and the resulting rules are readily interpreted.

Trees can be built using different metrics that measure how well the splits divide up the data classes: Gini index, entropy or misclassification error.

When the predictor variable is quantitative and not categorical, regression trees are used. Here, the data are still split but now the predictor variable is estimated by the average within the split boundaries. Tree growth can be controlled using the complexity parameter, a measure of the relative improvement of each new split.

Individual trees can be very sensitive to minor changes in the data and even better prediction can be achieved by exploiting this variability. Using ensemble methods, we can grow multiple trees from the same data.

Krzywinski, M. & Altman, N. (2017) Points of Significance: Classification and regression trees. *Nature Methods* **14**:757–758.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Logistic regression. *Nature Methods* **13**:541-542.

Altman, N. & Krzywinski, M. (2015) Points of Significance: Multiple Linear Regression *Nature Methods* **12**:1103-1104.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Classifier evaluation. *Nature Methods* **13**:603-604.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Model Selection and Overfitting. *Nature Methods* **13**:703-704.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Regularization. *Nature Methods* **13**:803-804.

The artwork was created in collaboration with my colleagues at the Genome Sciences Center to celebrate the 5 year anniversary of the Personalized Oncogenomics Program (POG).

The Personal Oncogenomics Program (POG) is a collaborative research study including many BC Cancer Agency oncologists, pathologists and other clinicians along with Canada's Michael Smith Genome Sciences Centre with support from BC Cancer Foundation.

The aim of the program is to sequence, analyze and compare the genome of each patient's cancer—the entire DNA and RNA inside tumor cells— in order to understand what is enabling it to identify less toxic and more effective treatment options.

Principal component analysis (PCA) simplifies the complexity in high-dimensional data by reducing its number of dimensions.

To retain trend and patterns in the reduced representation, PCA finds linear combinations of canonical dimensions that maximize the variance of the projection of the data.

PCA is helpful in visualizing high-dimensional data and scatter plots based on 2-dimensional PCA can reveal clusters.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Principal component analysis. *Nature Methods* **14**:641–642.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Clustering. *Nature Methods* **14**:545–546.