• Resolving Eye Shapes

Thu 31 January 2013 - 12:25:00 CST

#optics

If you have ever looked closely at the eyes of certain animals, you may have noticed something about the shapes of their pupils. Some animals, say humans, have round pupils while other animals, cats for instance, have tall thin pupils. And animals like deer and goats have pupils that are wider than they are tall. What are the advantages of each? One way of looking at the answer involves a quick diversion into spatial frequency analysis and properties of Fourier transforms.

Domestic cats have tall narrow pupils.

Consider light coming from two distant stars—pinpricks in the sky. The wavefront of the light expands spherically from each star, and by the time it reaches your eye, the sphere is so big that it seems basically flat, or planar, instead of curved. So what we have is a plane wave from each star, and because the stars are in different places, the waves are traveling at slightly different angles. Having different angles is equivalent to having different spatial frequencies (the reason is straightforward, but is a whole post by itself).

The pupils of deer are wider than they are tall.

When these two plane waves pass through an aperture like the anatomical pupil of your eye, the wavefronts are clipped. Immediately after the aperture, instead of being infinitely wide plane waves, they now stop at the edges of the aperture. These hard edges cause the light to diffract which results in additional frequency content after the aperture. Looking at this in the (spatial) frequency domain can shed some additional light.

In the plane of the aperture, a plane wave arriving at some angle appears as a sine wave when plotting energy vs. location. Consulting a table of Fourier transforms, a sine wave transforms into two delta functions—infinitely thin spikes sitting at particular frequencies. One delta is at the positive frequency and one is at the negative frequency. So having two plane waves at different angles leads to four delta functions in the frequency domain.

Left: two sinusoids of different frequencies (5 and 8 cycles per unit length) in the spatial domain. Right: the resulting delta functions in the spatial frequency domain.

The simplified aperture is just a rectangle function. This function equals 1 over the width of the aperture and equals zero everywhere else. In the frequency domain this becomes a sinc function

$$sinc(x)=\frac{\sin(\pi x)}{\pi x}$$

which is infinitely wide in frequency. And importantly, the horizontal scaling of the sinc function in frequency is inversely proportional to the width of the rectangle function: wide rect, narrow sinc lobes and vice versa.

Left: the rectangular aperture. Right: Its frequency content, the sinc function.

Now the plane waves passing through the aperture is equivalent mathematically to multiplying the plane waves by the aperture. While addition in space is also addition in frequency, multiplication in the spatial domain leads to convolution in frequency and vice versa. (Convolution: so that’s where that name came from.) So what do we get when we convolve a sinc function with two delta functions?

As it happens, convolution of anything with a delta function simply gives you a copy of the something shifted to the location of the delta. So convolving the sinc with four deltas gives us four copies of the sinc in the frequency domain. Instead of two discrete frequencies (four if you count positive and negative), we now still have a fair amount of energy at those original frequencies—the sinc functions are centered there—but we also have energy splashing into infinitely many other frequencies. This is the result of diffraction from the hard aperture.

The frequency domain result of the aperture clipping the two plane waves. Red and blue are the individual waves; black is the sum.

Now let’s move the original distant points of light closer together. The difference between the angles of the plane waves and thus the frequency separation of the delta functions decreases. But now after the convolution, the sinc functions’ main lobes have collided and blended together to where you can no longer tell there are two contributing peaks. You can no longer distinguish, or resolve, the sources as separate points. This is essentially the definition of resolution in an optical system. (Often the points are considered to be minimally resolved when the peak of one sinc function coincides with the first zero of the other.)

Frequencies (angles) are too close together to be resolved. (Frequencies are now 5 and 6 cycles per unit length.)

But wait! What if the aperture gets wider? This causes the sinc functions’ lobes to get narrower meaning that the light sources can be this close together while still being distinguishable. A larger aperture provides higher resolution.

The same frequencies as the previous plot, but increasing the aperture width has narrowed the sinc function, and the spots are resolvable again. (Aperture width increased from 0.5 units to 1.5 units.)

So back to the animals. A cat’s eye is tall and narrow. The vertical dimension of the pupil is larger giving the cat higher-resolution vision vertically than it has horizontally. This is useful for a cat climbing trees and looking for prey above and below. A goat or deer has the opposite orientation. Its pupil is wider than it is tall giving it higher-resolution vision horizontally, useful for a grazing animal watching for predators on open plains. And humans—and many other animals—have round pupils giving essential equivalent resolution vertically and horizontally. (Note that light exclusion also factors strongly into the function of animals’ eyes. For instance, cats often operate in the dark, so their retinas are quite sensitive. Their slit pupils can close down quite far during the day significantly reducing the amount of light getting in.)

The fundamental mathematics here—space/time vs. frequency domains, Fourier transforms, convolution—can be applied to countless problems in science and engineering. Be sure to subscribe to the blog to get new items as they come out, and leave comments and questions.

• Coins, Math, Things in the Universe

Thu 02 August 2012 - 12:52:00 CDT

A few weeks ago the big news about the Higgs boson came out, and I read an interesting article that talked about the experimental process. Now, I am not a particle physicist. If I’m any kind of physicist, I am a laser physicist—and yes, I know, photons are particles, but I deal more with the wave model. Anyway, more than the particles, what caught my attention right at the beginning of the article was the discussion about probabilities.

A lot of the discussion about Higgs also talks about matter vs. anti-matter and why we exist at all. If a particular particle has an even chance of decaying into, say, a proton and an anti-proton (and some other stuff), and when a proton and anti-proton meet they annihilate, why do we have protons?

This raises the probability question that goes back to the apocryphal fair coin: if you flip a fair coin ten times, what is the chance of getting five heads and five tails (the zero-sum, total annihilation, proton-free nothingness)? As it happens, the chance is a bit less than one in four. How do we calculate this?

Forget about ten flips for now. Putting on my computer scientist hat, ten flips with two possible outcomes each gives a ten-bit representation with 2^10=1024 combinations. Let’s go with four flips, sixteen possible combinations. These are easily written as the four-bit binary values with a round zero as a head and, for lack of a good analogy, a one for a tail:

Of these 16, six have two heads and two tails. 37.5%.

Remember when I said to forget about ten flips? Now forget about that, but go a step further. How do we calculate the probability of total annihilation for M heads in N flips?

First, what is the chance of M heads followed by (N - M) tails? This is just the chance of a head multiplied by itself M times, and that multiplied by the chance of a tail (N - M) times. For a fair coin, head and tail both appear with a probability of ½, so the overall chance is (½)^N. (For the four flips in the table, only the fourth row out of sixteen rows is two heads followed by two tails.)

But we don’t care about the order, so how many different ways can we distribute those M heads in N flips? This is where the binomial coefficient (or sometimes the “choose” notation) comes in. You have N slots. How many ways can you choose M of them?

If you have two slots and want to choose one, you have two possibilities. Three slots, three possibilities. With three slots and picking two, it’s also three possibilities because it is like picking one and then taking the two that you didn’t pick. In general? N-choose-M is written as:

$$\binom {N}{M} = \frac{N!}{M!\left(N-M\right)!}$$

So if you take the probability of getting two heads followed by two tails, 1/16, and multiply that by all the different ways you can pick two slots to put the heads in, 4-choose-2 = 6, you get 6/16=37.5% which is what we simply counted earlier.

Ten flips?

$$\left(\frac{1}{2}\right)^{10} \cdot \left( \frac{10!}{5! \cdot 5!} \right) = 24.6\%$$

Ten billion flips? A hundred billion? 1E1000? Exercise left for the reader.

So based on this math, the chance of getting an even number of protons and anti-protons becomes vanishingly small over eons of decay events. When you factor in that the probabilities of the results are actually unequal—the coin isn’t even fair—the overall imbalance becomes larger still. When you factor in that the universe is expanding, and the chance of x/anti-x annihilation decreases due to just having a lot more space, even more imbalance.

And this is—at least a part of—why there is something.

• MD5

Mon 23 July 2012 - 16:07:00 CDT

#software

I thought we were pretty much past corrupted downloads at this point in the century, but apparently not.

I’ve been doing some software work recently, and I needed to download a demo compiler. The download completed, and I started the install, but it never finished. It turns out that the install crashed because it had managed to fill up the 20GB of free space in my Windows virtual machine. And that happened because the installer file was incomplete and it went off into the weeds.

Three download attempts and two hours later using a total of two OSs and three different browsers, I finally got the complete file. (Especially disappointing given that the full version of this compiler is rather expensive.)

So Pro Tip: always at least check file sizes. Also on OSX you can calculate the MD5 checksum of a file from the terminal using:

\$ md5 myfile


On Windows, there are several free utilities a Google search away.

• En?t[oy]mology

Mon 16 July 2012 - 20:45:00 CDT

#software

Driving home today, I was listening to a podcast discussing beekeeping and the strange disappearance of bees. They mentioned the Latin names of some desirable (to bees) flowers and also of the bees themselves.

I had to wonder if anyone out there studies the origins of names of insects. Would that person be an entomologist, etymologist, or both?

(Oh, the title: if you need a good online resource for learning about or testing regular expressions, check out http://rubular.com.)

• Up and Running

Sat 07 July 2012 - 12:05:00 CDT

Well, after about a month of on-and-off effort, this website is up in its initial form. When I left my previous job at the end of May, I had a business in the back of my head, but my primary reason for departure was to spend time focusing on my Ph.D. dissertation.

Unfortunately, I almost immediately hit a roadblock with some needed holographic materials being on a 5+ week lead-time. So, with less to do in the lab in June than I anticipated, I set off down the road of launching this business and designing this website.

There is more to do on the site—a lot of it is behind the scenes for my benefit—and I have enjoyed learning Rails and doing some graphic design work. But that is not the core of the business obviously.

Convolution Research exists to develop technologies and applications of those technologies to improve the world for all of us. We (I) do this by applying skills in pure science, research, electrical and software engineering, and product design to your impossible problems and my own (I have a few ideas brewing).

I hope you like the site. As things move forward, I will be posting about science, engineering, and project and requirements management, along with posting news and interesting articles.

Be sure to check in from time to time; follow us (and me) on Twitter; subscribe to the blog; and contact us (me for now) when you hit your next impossible problem.