Different definitions of e (Part 11): Numerical computation

In this series of posts, we have seen that the number e can be thought about in three different ways.

1. e defines a region of area 1 under the hyperbola y = 1/x.logarea2. We have the limits

e = \displaystyle \lim_{h \to 0} (1+h)^{1/h} = \displaystyle \lim_{n \to \infty} \left(1 + \frac{1}{n} \right)^n.

These limits form the logical basis for the continuous compound interest formula.

3. We have also shown that \frac{d}{dx} \left(e^x \right) = e^x. From this derivative, the Taylor series expansion for e^x about x = 0 can be computed:

e^x = \displaystyle \sum_{n=0}^\infty \frac{x^n}{n!}

Therefore, we can let x = 1 to find e:

e = \displaystyle \sum_{n=0}^\infty \frac{1}{n!} = \displaystyle 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} + \dots

green line

Let’s now consider how the decimal expansion of e might be obtained from these three different methods.

1. Finding e using only the original definition is a genuine pain in the neck. The only way to approximate e is by trapping the value of e using various approximation. For example, consider the picture below, showing the curve y = 1/x and trapezoidal approximations on the intervals [1,1.8] and [1.8,2.6]. (Because I need a good picture, I used Mathematica and not Microsoft Paint.)

approx_e_lower

Each trapezoid has a (horizontal) height of h = 0.8. Furthermore, the bases of the first trapezoids have length \displaystyle \frac{1}{1} = 1 and \displaystyle \frac{1}{1.8}, while the bases of the second trapezoid of length \displaystyle \frac{1}{1.8} and \displaystyle \frac{1}{2.6}. Notice that the trapezoids extend above the hyperbola, so that

\displaystyle \int_1^{2.6} \frac{dx}{x} < \displaystyle \frac{0.8}{2} \left( 1 + \frac{1}{1.8} \right) + \frac{0.8}{2} \left( \frac{1}{1.8} + \frac{1}{2.6} \right)

\displaystyle \int_1^{2.6} \frac{dx}{x} < 0.9983 < 1

However, the number e is defined to be the place where the area under the curve is exactly equal to 1, and so

\displaystyle \int_1^{2.6} \frac{dx}{x} < \displaystyle \int_1^{e} \frac{dx}{x}

In other words, we know that the area between 1 and 2.6 is strictly less than 1, and therefore a number larger than 2.6 must be needed to obtain an area equal to 1.

Great, so e > 2.6. Can we do better? Sadly, with two equal-sized trapezoids, we can’t do much better. If the height of the trapezoids was h and not 0.8, then the sum of the areas of the two trapezoids would be

\displaystyle \frac{h}{2} \left( 1 + \frac{2}{1+h} + \frac{1}{1+2h} \right)

By either guessing and checking — or with the help of Mathematica — it can be determined that this function of h is equal to 1 at approximately h \approx 0.8019, thus establishing that e > 1 + 2h \approx 2.6039.

e_twotrapezoids

We can try to better with additional trapezoids. With four trapezoids, we can establish that e > 2.6845.

e_fourtrapezoids

With 100 trapezoids, we can show that e > 2.71822.

e_hundredtrapezoidsHowever, trapezoids can only provide a lower bound on e because the original trapezoids all extend over the hyperbola.

green lineTo obtain an upper bound on e, we will use a lower Riemann sum to approximate the area under the curve. For example, notice the following picture of 19 rectangles of width h = 0.1 ranging from x =1 to x = 2.9.

approx_e_upperThe rectangles all lie below the hyperbola. The width of each one is h = 0.1, and the heights vary from \frac{1}{1.1} to \frac{1}{2.9}. Therefore,

\displaystyle \int_1^{2.9} \frac{dx}{x} > \displaystyle 0.1 \left( \frac{1}{1.1}+ \frac{1}{1.2} + \dots + \frac{1}{2.9} \right)

\displaystyle \int_1^{2.9} \frac{dx}{x} > 1.0326 > 1

In other words, we know that the area between 1 and 2.9 is strictly greater than 1, and therefore a number smaller than 2.9 must be needed to obtain an area equal to 1. So, in a nutshell, we’ve shown that e < 2.9.

Once again, additional rectangles can provide better and better upper bounds on e. However, since rectangles do not approximate the hyperbola as well as trapezoids, we expect the convergence to be much slower. For example, with 100 rectangles of width h, the sum of the areas of the rectangles would be

h \displaystyle \left( \frac{1}{1+h} + \frac{1}{1+2h} + \dots + \frac{1}{1+100h} \right)

It then becomes necessary to plug in numbers for h until we find something that’s decently close to 1 yet greater than 1. Or we can have Mathematica do the work for us:

e_hundredrectanglesSo with 100 rectangles, we can establish that e < 2.7333. With 1000 rectangles, we can establish that e < 2.71977.

Clearly, this is a lot of work for approximating e. With all of the work shown in this post, we have shown that e = 2.71\dots, but we’re not yet sure if the next digit is 8 or 9.

In the next post, we’ll explore the other two ways of thinking about the number e as well as their computational tractability.

2 thoughts on “Different definitions of e (Part 11): Numerical computation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.