Friday, March 4th, 2011...12:26 pm
Riemann sum&ms
Did you know that M&Ms can be integral to a Calculus lesson? Be forewarned that you may have a decision to make. Using only pictures, like in this blog entry, you can take more of a theoretical chocolate analysis of Calculus. Or, buy a big bag of M&Ms and dig in, for hands-on learning, of course.
A Riemann sum is a method for approximating the total area underneath a curve on a graph, otherwise known as an integral. The method was named after German mathematician Bernhard Riemann. The algorithm can be seen as nailing a row of planks side by side to cover the space under some curve. The thinner you make the planks, the closer they will be to covering only the area under the curve. Helpful analogy? Probably, especially if you jazz it up with a story of what might be behind the wall you’re building!
Let’s change gears though and build a mosaic with M&Ms. We’ll motivate integration with an M&M mosaic using the techniques of Professor RieMMann and find the area under the curve y = sin(x) and over the interval from 0 to π on the x-axis. We will use the graph below:
The x-axis on this graph is over the interval from 0 to π. The y-axis is over the interval from 0 to 1. Therefore, the total area of the graph is π.
Now, we cover the graph with n by 3n non-overlapping squares. For each square, we determine if there are more black pixels or white pixels. If more pixels are black, then we place a green M&M in the square, else, we place a yellow M&M in the square. Suppose we begin with 5 by 15 squares. Then, we get the M&M mosaic seen below.
This picture has 50 green M&Ms out of 75 total M&Ms. How do we use this to find the area of y = sin(x)? In the mosaic, 50/75ths of the squares are filled with green M&Ms. Using ratios, (area under curve)/π ≈ 50/75 which means our approximation to the area is:
So, our first M&M mosaic estimates the area under the curve y = sin(x) and over the x-axis as 2.0944.
Now, let’s be more refined and use 10 rows and 30 columns of M&Ms as seen below. Here 194 out of 300 M&Ms are green. This leads to an estimate of 2.0316.
Finally, let’s create an M&M mosaic with 20 rows and 60 columns of candies. How do we do? Out of 1200 M&Ms, 771 are green, giving us an estimated area of 2.0185.
The exact area under the curve and above the x-axis is 2, which can be found using a tool of Calculus called the integral. This would be expressed as
Can we use our technique with M&Ms to find such an area? If Professor RieMMann leans on the idea of Riemann, Newton and Leibniz, then we want to use M&Ms of decreasing radius. If we do, then as the radius of the M&Ms goes to zero, the estimated area will converge to the actual area under the curve. There is another outlook on the method. You keep enlarging the image and use normal M&Ms to create the mosaic. Then, as the number of total M&Ms goes to infinity, your estimated area will again converge to the area under the curve! Yum!!!! Fattening, but, of course, it is all in the name of Calculus!!!!





28 Comments
April 12th, 2011 at 2:33 am
I learned about Monte Carlo methods for the first time in a Modern Physics course. This is great. Thank you for taking time to put things like this up. Now I’m reading a book put out by Springer, “Explorations in Monte Carlo Methods.” Great fun. Hope you don’t mind, but I shared the link with my class.
Cheers.
ps the Dell’Arte grad is impressive to me. Two of the best men I know are graduates.
April 15th, 2011 at 10:24 pm
Oh I get it now… RieMMann! M & Ms sure are aweSUM! BTW this is for Douglas:
Welllmmmudfdmfdmf….