Friday, May 11, 2012

Bad for Men, Bad for Women, But Good for Humans as a Whole?

Suppose a company is testing a new drug. It is less effective than the placebo at treating men. Also, it is less effective than the placebo at treating women. Yet the company claims that overall, it is actually more effective than the placebo! Can this happen, and if so, how?

Today we are going to look at a probability "paradox", sometimes called "Simpson's Paradox". As you will see, it is not really a paradox - math does work, after all - it simply gives what initially seems to be a counter-intuitive answer. By the end of this post, you will understand what is going on and how to protect against it in real world situations.

Thursday, April 12, 2012

Tax Rate Graphs

April is tax season, so I thought it would be interesting to draw some graphs related to tax rates. We won't need advanced mathematics, but we will use R to make the graphs. As regular readers will recall, R is a widely used, free, high quality, open source, cross platform programming environment, well suited to graphing and doing statistical calculations, and also easy for beginners to learn to use. We won't be giving tax advice, of course, but we can draw some interesting generic graphs that help visualize the difference between average and marginal tax rates.

Sunday, March 18, 2012

Algorithmic Art

One of my favorite mathematical recreations is to create algorithmic art: images constructed using computer programs and mathematical formulas. An image is just a collection of pixels (colored dots) arranged in a rectangular grid. The computer program loops over each pixel in the image, using whatever mathematical formula you want to specify its color.

There are many algorithms for selecting the colors, each with its own signature style. For example, many web sites have beautiful pictures of fractals like the Mandelbrot Set, with each point colored based on the results of iterating a complex dynamic system. Alternatively, the POV-Ray Hall of Fame hosts images created using the free, open source 3-D ray tracing program POV-Ray, which colors each pixel by tracking it back to a 3-D object or light source, yielding a photo-realistic image of a virtual scene complete with shadows and reflections.

Today, however, I want to share a short C++ program I wrote to experiment with a much simpler approach. I've used it to make images like these four:

Tuesday, February 21, 2012

Applications of the Golden Mean to Architecture

Back to an earlier discussion on what makes artistic designs attractive: in the following image, do you prefer the version on the left or the version on the right?

At the end of today's post I will explain the difference and show you the code for constructing this picture using R. Be sure the little circle in the middle looks like a circle: if it looks like an oval instead, try clicking the picture to get a bigger version. The circle verifies that you are seeing the picture without browser-induced aspect ratio distortion.

First, though, we have a new article from Guest Author Nikos A. Salingaros, Professor of Mathematics, Urbanist & Architectural Theorist at the University of Texas at San Antonio.

As you may recall, Nikos wrote a previous Guest article, Why Monotonous Repetition is Unsatisfying, back in September 2011, in response to Quilt Patterns. He has also written The "Life" of a Carpet: an Application of the Alexander Rules, which is the best (most "mathematically" oriented) article I have yet seen on the web on the topic of what characteristics of a work of art make it aesthetically pleasing.

One characteristic often discussed in books on photography and other visual arts is the Golden Ratio. In today's article, Nikos argues that the Golden Ratio is actually more hype than substance. See what you think, and we will revisit the image above at the end.


Applications of the Golden Mean to Architecture

Nikos A. Salingaros, The University of Texas at San Antonio.

Saturday, February 11, 2012

Numerical Analysis: How to Calculate Special Functions

Your calculator has buttons for all sorts of special functions, like square root, sine, cosine, and logarithms. How does the calculator know how to calculate these functions? In arithmetic, you learned to add, subtract, multiply and divide "by hand". With only those four basic operations available, where would you even start if you had to calculate a square root or transcendental function? Today we are going to explore a little bit of Numerical Analysis, which is the branch of math that focuses on actually calculating things numerically, with high accuracy and efficiency.

Friday, January 13, 2012

Logarithms

Today I want to give a painless introduction to logarithms, a subject most people dislike so much they block it from their memories of high school algebra class.

What do music, earthquakes, social networks, and income inequality have in common? All involve multiple scales, i.e. numerical quantities that range from very small to very large. Logarithms provide a very convenient way of discussing these kinds of phenomena.

Pitch and loudness in musical notes, the destructive power of an earthquake, the number of friends a person has on Facebook, and the distribution of income by person, city, or country - all involve measurements that can vary by many orders of magnitude. The numbers involved could be small, like 1 or 2, or medium sized, like 1000, or very large, like 1,000,000 or more. It is awkward to try to compare such different numbers. In many disciplines, people have invented alternative "scales" to describe them: for instance, decibels measure sound intensity, while the Richter scale measures earthquakes. The intent of these scales is to convert the huge range of numbers down to something manageable by a person, such as the range from one to ten.

Saturday, December 17, 2011

Modular Arithmetic, Prime Numbers, and a Little Bit of Cryptography

A three-hour movie begins at 11am. When does it end? In countries like the US that use a twelve hour clock, we say it ends at 2pm, even though 11 + 3 = 14. This is a first example of modular arithmetic, a simple and beautiful generalization of ordinary arithmetic that underlies much of modern cryptography and your ability to safely conduct financial transactions on the web.

One of the first multiplication facts you learn in school is 12 = 3*4. Numbers that can be factored into smaller pieces this way are called composite. Not all numbers are composite; those that are not are called prime. 13 is prime, because if it did have factors, at least one would be smaller than 4 (since 4*4 is 16, which is already too big), yet neither 2 nor 3 works.

Subtle connections between modular arithmetic and prime numbers led to the invention of public key codes, which have all sorts of uses, including allowing people to digitally sign documents and to verify that the documents have not been tampered with during transmission.

Today we are going to start at the beginning and explore how modular arithmetic works and how it connects with prime numbers. By the end you will understand how public key codes perform their magic, all without any math beyond multiplying whole numbers.