Shining Light Into Liquids

One of my favorite xkcd cartoons is Crazy Straws which ends with the sentence, "Human subcultures are nested fractally. There's no bottom."

I was reminded of it when I first came across the Beer-Lambert equation. The equation describes how the intensity of a light source is attenuated as the light from it passes through a material. I heard about it on a site where someone was trying to solve a problem using it. I didn't know a thing about the physical properties and laws that govern materials, so I spent a pleasant afternoon reading about things I would never have otherwise read about. I was scratching the surface of an endless, fractally-nested body of knowledge.

The concepts are simple enough but the equations that govern them are quite complicated (at least for me). When this happens, I try to visualize or to simulate to get a better handle on what's going on. In this case, I went for visualizations. 

You can download the Mathematica notebook to see the calculations and play with an interactive contour plot.

What We're Trying to Describe

Think of a cylindrical vessel of radius R that contains a liquid. The vessel has a completely transparent window through which you shine a light. How does the intensity of light drop off as the light travels through the liquid? 

Figure 1: Cross-section of a cylindrical vessel (view from above)
We can define any point in the cross section in figure 1 with a vector r whose length is $r_{p}$, the distance measured in centimeters from the center of the cross section, and whose direction is $\theta_{p}$, the angle described by r.

For a given vector r, the distance L from the edge of the cylinder where the light is shone can be written as:

$L(r,\theta) = |\sqrt{R^2- r\cos^2\theta} - r\sin\theta|$,  for r = 0 to R and $\theta = 0$ to $2\pi$

The Beer-Lambert law gives the value of the intensity I for all values of r and $\theta$, once three values have been fixed. The first value is the intensity of light that is shone through the window of the vessel, $I_{0}$. The second value is the molar attenuation coefficient ($\varepsilon$) and is a property of the liquid (or material) that fills the vessel. The third value is called the molar concentration ($c$), which is another property of the material that fills the vessel. 

Given these 3 constants, the intensity of light at any point in the cross section of the vessel can be written as:

$I(r,\theta) = I_{0} 10^{-\varepsilon c N_{A} L[r,\theta]}$

where $N_{A}$ is Avogadro's constant which is $6.023$x$10^{23}$. The term $c N_{A}$ is called the number density.

Let's visualize the attenuation of intensity described by this equation to get a better handle on how it works. 

What the Beer-Lambert Equation Looks Like

If I had to guess how light attenuates in a material, I'd say it has to do with the intensity, the type of material. It shouldn't really have anything to do with the size of the vessel.  But how exactly does it have to do with intensity and type of material? We can check by simulating three different size vessels and visualizing the results by plotting contours of intensity within the vessels. Here's what it looks like.

Figure 2: Intensity contours for vessels that are 3, 6, and 9 cm in cross section

Sorry, I had to bust the template to make the contours legible. Imagine the light source at the top of each of these circles, shining down into the cross section. A squint test shows that the blues deepen faster from left to right. The deeper blues signify less light (and hence more attenuation); it makes sense that the more the light has to travel inside the vessel, the more its intensity gets attenuated. 

If you follow right down the middle from top to bottom, the intensities (the numbers in orange) decrease. Although the circles are all drawn to the same size (that's a bit unfortunate, but bear with me), you can see the effect the radius of the vessel has on attenuating the intensity. Have a look at the "0.5" mark on the left, towards the middle of each of the circles. On the y axis, this is a point that is 2.5 cm inside the first vessel, 5.5 cm inside the second vessel and 8.5 cm inside the third vessel. Reading left to right, the intensities at these points are roughly, 76, 53, and 37 from left to right. 

So far so good. The contours give us a good visual feel for the bands of equal intensity. But how quickly does the intensity drop as a function of distance? Is it linear, or some more complicated function? It's hard to know just from the contour plots. 

Figure 3: Intensity at various distances from the center for vessel cross sections of 3, 6, and 9 cm
Figure 3 is a different way to visualize the same phenomenon -- it supplements the information provided by figure 2 and allows us to see that the intensity drop is indeed non-linear. We can also see that when the vessel cross section is small, say around 3 to 6 cm, the intensity drop can be approximated by the linear function. 

  • Observation 1: As light travels through the vessel, its intensity is attenuated in a non-linear way. 
  • Observation 2: If the vessel cross section is sufficiently small, the intensity attenuation is roughly linear.
  • Observation 3: If you pick a point inside the vessel and want to double the intensity at that point, you need to change the size of the vessel to 1/3rd its current size. (You can check this by looking at the points along the horizontal axis where distance from the center is 0.)

Not bad for just a glance at two visualizations. And of course, for all of these observations, they only hold roughly; and because the attenuation of intensity is non-linear, there will be cross section lengths beyond which the observations will not hold. 

Starting with Different Intensities

Now let's keep the vessel size and the material concentration the same but vary the intensity. Once again, let's plot the contours and supplement them by the line plots to learn what the Beer-Lambert equation dictates.

Figure 4: Intensity attenuation for initial intensities 50, 100, and 150

At the 5.5 cm mark inside the vessel we see behavior we'd expect -- when the initial intensity is 50, the intensity at the 5.5 cm mark is around 27; when the initial intensity is 100 the value is around 54 (which is double the former) and when the initial intensity is 150 the value at the 5.5 cm mark inside the vessel is roughly 80 (which is triple the first value). So it seems like as intensity increases, the attenuation at a fixed point inside the vessel is a linear function of the intensity. 

But let's check this using our second type of visualization -- the line plots. 

Figure 5: Attenuation as the initial intensity changes

Figure 5 shows us that the thought we had about the linear change in intensity attenuation does hold. At the center of the vessel (the horizontal axis in figure 5), the intensities do go from 25 to 50 to 75 as the initial intensity goes from 50 to 100 to 150. And holds at every other point in the vessel as you can check by drawing a horizontal line that intersects all three curves and reading off the intensity values from the horizontal axis. They will indeed be a 1x, 2x and 3x.

  • Observation 4: At any point inside the vessel, if you want to double the intensity of light, then you have to double the intensity of light you start with.

Once again, we've found something we didn't know before -- when it comes to the attenuation of light in a material, the size of the vessel and the initial intensity have different effects on the attenuation. Not only do we know that they're different, we can even quantify how they're different. And not just for the lines we've plotted -- it's easy to interpolate to find values of attenuated intensity at various points in the vessel for any initial intensity between 50 and 150. That's a lot of information just at a glance! 

Intensity Attenuation as the Concentration of the Liquid Varies

Finally, let's shine a light of fixed initial intensity through a vessel of a given size and look at how the concentration of the material through which we're shining light affects the attenuation of light at various points in the vessel. (That's quite a mouthful isn't it?)

Figure 6: Intensity attenuation as concentration changes while initial intensity and vessel size remain fixed

Just from squinting at figure 6 and comparing with figures 4 and 2, it's a good bet that concentration is the variable that has the highest impact intensity attenuation. This is quite apparent from looking at the variation in blue from left to right in figure 6. The leftmost contour plot in figure 6 is almost all light blue. The difference between it and the plot in the middle of figure 6 is quite stark. And likewise for the bands of deep blue on the rightmost plot in figure 6 compared with its cousins on its left. 

  • Observation 5 [Incorrect]: The highest-impact way to change the intensity of light at a given point within the vessel is to alter the concentration of the material in the vessel.

Is observation 5 true? Let's look at the line plots. 

Figure 7: Attenuation as the concentration of the liquid changes

We can quickly see from figure 7 that Observation 5 can't be true. Let's look along the horizontal axis at the point on the vertical axis that marks -6 -- that's the other end of the cross section from which the light is. At a concentration level of 0.01, the intensity at the other end of the vessel is roughly 75. At a concentration of 0.05 which is 5 times the previous concentration,  the intensity is 25. So when concentration goes up 5x, intensity at that point goes down by a factor of 1/3. Or, conversely, if I want to triple the intensity at a certain point in the vessel, I need to decrease the concentration by a factor of 5. Note that the curves in figure 7 are closer together near the top (as we get closer to the light source) and therefore, the rate of decrease increases as distance traveled into the vessel increases.

We can now rewrite Observation 5 correctly as: 
  • Observation 5': The highest-impact way to change the intensity of light at a given point within the vessel is to change the initial intensity of the light source.
  • Observation 6: To triple the intensity at a certain point in the vessel, decrease the concentration by a factor of 5. 
  • Observation 7: The multipliers in Observation 6 vary -- they get higher as the point in question gets farther from the light source.

Lessons Learned

Even without knowing much about the properties of materials or the mathematics of the Beer-Lambert equation, we used two types of visualizations in concert to come up with a handful of useful observations. Having both types of visualizations helped us do better than having just one or the other. We were able to get a gut feel for the behavior of light in materials, correct initial mis-impressions, and assess the relative impact of the three variables that affect the intensity of light in materials. 

You can download the Mathematica notebook to see the calculations and play with an interactive contour plot.