Sunday Function

Today is Easter Sunday, the most sacred and second most widely observed holy day in the Christian calendar, celebrating the resurrection of Jesus. Friday was Good Friday, the remembrance of the crucifixion. Thus after spending three days buried, Jesus rose from the dead.

Wait, three days? Let's see... Friday night to Saturday is a couple of hours, Saturday is a full day, and Sunday morning is a few more hours on top of that. So a day and a half, then. But of course all the liturgy and ceremony talks about three days.

This is because the ancients counted time as opposed to measuring it. (The great pop-math book Prime Obsession discusses this in detail) Some modern cultures including our own in some contexts do the same thing. You might work a five-day week, despite only working 40/24 = 1.67 whole days.

This difference between numbers treated as discrete countable entities and numbers as smooth measurements of continuously varying quantities informs large sections of the math used in physics. Let's grab a function defined as a sum, like this:


In other words, f(3) = log(1) + log(2) + log(3), and so on for other values of N.

This kind of problem is very tricky in general for large N. Maybe you don't want to add up a few trillion trillion terms, should N happen to be huge. Maybe the thing we're summing doesn't really have any tricks that let us sum it exactly using shortcuts - which is generally the case. But if we quit thinking of this as a discrete sum and as more of a continuous measurement we can make progress. Let's graph it with Mathematica.


The area of each rectangle is equal to one term in the series. The total area of the rectangles is the sum. But we also know that the area under the curve defined by the continuous function f(x) = log(x) is not too far from being the same thing. After all, an integral is just the limit of a sum as the width of the rectangles approaches zero. Nothing prohibits us thinking about that process in reverse. So if N is large enough so that the individual imprecision between each rectangle and its associated section of curve are small, we can say that


Now we can't be guaranteed that the sum and the integral actually become the same with large N, only that their percent difference goes to zero. And that's pretty much all we want as physicists.

How good is the approximation? Well, for N = 100 the sum is 363.739. For N = 100 the integral approximation is 361.517. Not half bad, given that the effort involved in evaluating the expression for the integral (it's 1 - N + N log(N), easy to find if you've had calculus) for your specific N. Much more easy than laboriously evaluating 100 or more logarithms in your calculator and adding them up.

You might even call it a salvation of sorts.

More like this

But of course all the liturgy and ceremony talks about three days.

Even a 40+ year atheist like me knows that this is nonsense.

"On the third day ..."

By Scott Belyea (not verified) on 12 Apr 2009 #permalink

Well that's kind of what I was talking about - they're two ways of saying the same thing, and you'll see both "on the third day" and "three days" referenced in both the bible and the liturgy. For instance, in Matthew 27:

"The next day, the one after Preparation Day, the chief priests and the Pharisees went to Pilate. "Sir," they said, "we remember that while he was still alive that deceiver said, 'After three days I will rise again.' So give the order for the tomb to be made secure until the third day. Otherwise, his disciples may come and steal the body and tell the people that he has been raised from the dead. This last deception will be worse than the first."

"Take a guard," Pilate answered. "Go, make the tomb as secure as you know how."

Sorry, Matt, but you've made a fence post error. To approximate the sum of the areas of the recangles you need to integrate to the far end of the rectangle so your integral should be to (N+1). Note that your red line is always above the rectangles so your integral estimate should be larger than the correct value, not smaller.

Integrating from 1 to 101 gives a value of roughly 366, which is still a good approximation.

For monotonically increasing functions like log(), though, there's a very neat trick. Drive your red line through the middles of the tops of the rectangles rather than skimming their corners. With monotonic functions this gives two triangular patches at the top of each rectangle, one above the curve and the other below. These roughly cancel giving a superior approximation.

In your example this means you integrate log(x-1/2) from x=3/2 to x=N+1. I reckon that gives 363.821 which is an even better estimate.

By Bob Dowling (not verified) on 12 Apr 2009 #permalink

Matt, do you consider the resurrection to be an actual historical event?

By Max Fagin (not verified) on 12 Apr 2009 #permalink

Bob's approximation is, essentially, this:

1 - N + N log(N) + 0.5 log N

You can get even closer than this by using the Euler-Maclaurin formula to estimate the difference between this and the sum. You get:

0.5 log (2 pi) - N + N log(N) + 0.5 log N

which is Stirling's approximation.

By Pseudonym (not verified) on 12 Apr 2009 #permalink

You're right, Bob. Of course it doesn't matter in percentage terms for large N, but for smaller or intermediate N you'd want to use your method for a better approximation. In fact I believe monotonicity is not required to improve on the estimate using the midpoint rule. While I'm a little rusty on the details I think it buys you another power of N in the speed of the convergence.

Max: An important question, isn't it? For now I'm going avoid answering, as I think the light/heat ratio religion-blogging generates around ScienceBlogs is rarely worth the effort.

I've got notes around here somewhere on calculating the exact error introduced by converting a summation to an integral. My comp sci advanced algorithms class insisted on exact solutions to the summations, including that little bit of error.

I, too, have often thought that Isaac Newton was kind of like Jesus.

By NewtonWasJesus (not verified) on 13 Apr 2009 #permalink

I think it was simpler to note that your expression is equal to log(N!)... bye

By beddrumiu (not verified) on 13 Apr 2009 #permalink

You have an integral expression that represents an upper bound on the sum. You can also write another integral expression that represents a lower bound on the sum. Almost as important as knowing the approximate answer is knowing the absolute error bounds on this approximation.