PDA

View Full Version : Question regarding "e"


Projector
Dec27-07, 05:43 PM
I've been stumped by this question for a while now:

Find a value of n for which (1+ 1/n)^n gives the value of "e" correct to 9 decimal places.

D H
Dec27-07, 06:04 PM
Have you tried any values of n?

HallsofIvy
Dec27-07, 06:51 PM
Looks like a straightforward calculation problem to me!

ice109
Dec27-07, 08:08 PM
lol, look up e on wikipedia and you'll know why we're giggling over here

Jeff Reid
Dec28-07, 01:33 AM
Trick question? 9 significant digits or 9 digits after the decimal point?

D H
Dec28-07, 08:12 AM
It is a trick question in a sense. Just throwing numbers at a typical computer implementation of (1+1/n)^n won't work. The problem lies in how computers represent real numbers.

Suppose one uses a program like Excel or writes a simple program to calculate (1+1/n)^n (I did just this with Excel, perl, and C on a Mac and on a Linux box.) The error shrinks as n increases up until n=10^7 or so. At this point the error stops shrinking. The problem is that the computer performs the calculation (1+1/n)^n as \exp(n*\log(1+1/n))[/tex]. For large n, [itex]log(1+1/n)\approx(1+1/n)-1, and this will err from 1/n using off-the-shelf double-precision numbers. For sufficiently large n (1016 or so), (1+1/n)-1=0 using off-the-shelf double-precision numbers!

A brute-force way to overcome this problem is to program using an extended precision package. An even better way to overcome the problem is to approach it analytically. A simple error analysis of (1+1/n)^n-e yields a value of n above which the error will be smaller than 1e-9. I am not revealing this value in the chance that this thread is asking us to solve a homework problem.

Since I have a "certain type of brain that's easily disabled (http://www.physicsforums.com/showthread.php?t=206096)", I of course had to double-check this limit using an extended precision math package. Ta-da, it works as predicted.

mathwonk
Dec30-07, 12:59 PM
i had a homework assignment in 1960 to use the taylor series to calculate e to 9 digits, and found it too tedious.

In 2006 I felt professionally embarrassed after telling the story to my calc class so sat down and did it by hand, using a small $10 calculator for some arithmetic. (It took about 14 terms, but your sequence will have a different error term from the taylor series, so i doubt if i am giving away the answer.)

My former calc prof was still working in texas so i sent him the hw with an apology for being over 40 years late. he kindly wrote back his appreciation. maybe you too will eventually get credit for this one.

arildno
Dec30-07, 01:03 PM
Psst, the 9th digit is...8! :smile:

Two point 7, two times Ibsen, 459045.

Dodo
Dec30-07, 01:57 PM
Ibsen, or Verne, or Schubert... (google for the win).