Sunday, February 21, 2010

Calculating Integrals In The Climate Scientist Starter Kit

Since I showed you how to calculate the derivatives of CO2, I figured I'd show you how to calculate the integral as well. Just like calculating derivatives, calculating integrals is surprisingly easy.

Calculating Integrals In The Climate Scientist Starter Kit
The first thing we need to know is just what an integral is. Another name for integral is "area under the curve", and that's just what an integral is, the area from the bottom of the graph to the place where the lines are. To demonstrate this visually, I plotted a graph that has CO2 twice, once as a line and once as a set of bars. The distance between the bars was set to zero. Here's what the graph looks like:

You can see that when CO2 is plotted as a set of bars, it completely fills up the area under the curve of CO2 plotted as a line. This is exactly what an integral is! So we know there's enough information just from the CO2 values to get the integral. So how do we get the actual number value for the integral?

It's simple. We add up the values for all the bars. This can be done with a simple sum() function:

=SUM(COLUMN_NAME)

Done!

Calculating Integral Ranges
Suppose we want to find the integral of just part of the graph, say between the 5th and 10th months listed. This can be done by taking the integral for each range and subtracting the results.

=SUM(COLUMN_NAME_ROW_1:COLUMN_NAME_ROW_OF_FIRST_VALUE)
=SUM(COLUMN_NAME_ROW_1:COLUMN_NAME_ROW_OF_SECOND_VALUE)
=SECOND_INTEGRAL - FIRST_INTEGRAL

Example:
=SUM(C1:C5)
=SUM(C1:C10)
=SECOND_INTEGRAL - FIRST_INTEGRAL


The first function gives us the integral of columns 1 through 5. The second function gives us the integral of columns 1 through 10. Subtracting the first integral from the second integral gives us the integral of columns 5 through 10.

Previous Posts In This Series:
CO2 Derivatives (Not Al Gore's Kind Of Derivatives)

No comments:

Post a Comment