0% found this document useful (0 votes)
11 views

How to Design Your Own π to e Converter

Methods for converting the digits of pi to digits of e.

Uploaded by

harlen12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

How to Design Your Own π to e Converter

Methods for converting the digits of pi to digits of e.

Uploaded by

harlen12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

published by the

American Mathematical Association of Two-Year Colleges

volume 30 • number 1 • fall 2008

The AMAT YC Review


How to Design Your Own π to e Converter

Harlan J. Brothers

Harlan Brothers is Director of Technology at The Country School in


Madison, CT where he teaches programming, fractal geometry, and gui-
tar. Having worked for six years with Michael Frame and Benoit Man-
delbrot at the Yale Fractal Geometry Workshops, he now lectures on the
subject of fractal music. Harlan is also an inventor with five US patents.
E-mail: [email protected]

The base of the natural logarithm, e, has been studied since the early seven-
teenth century (Maor, 1994, pp. 26–27). Its limit definition formula
n
e = lim 1 + n1 (1)
n→∞

is a variant of the compound-interest formula used in finance (Anton, 1980, p. 558;


2; Bradley & Smith, 1999, pp. 63–64). This article demonstrates how a simple
restatement of (1) can lead to the derivation of a fascinating family of functions that
can be used to convert the digits of π to those of e.

Generalizing the Limit Definition of e


Starting with the right hand side (RHS) of (1), we can treat it as a real function
of two variables, r and s. Replacing the integer n with a rational number in the form
r/s we have
r
e = rlim r+s r
s |r| > |s|, r, s 6= 0 (2)
| s |→∞
Thus, the greater the ratio between r and s, the better (2) approximates e.
The value of (2) is that it can be redefined more broadly as a compound function
of one variable by replacing r with subfunction f (x) and s with subfunction g(x).
The result is a formula we refer to as the Generalized Classical Method (GCM).

Given: f (x) and g(x) are monotone over x, |f (x)| > |g(x)|, and f (x), g(x) are
divergent, then

  f (x)
f (x) + g(x) g(x)
GCM (x) = f (x), g(x) 6= 0 (3)
f (x)
30 How to Design Your Own π to e Converter

and
  f (x)
f (x) + g(x) g(x)
e = lim (4)
|x|→∞ f (x)

New connections between π and e


When we assign f (x) and g(x) using the appropriate trigonometric subfunc-
tions, the functions that result, in their limits, define new relationships between π
and e.
For example, we can set f (x) = cos(θ) and g(x) = sin(θ). As θ approaches π,
cos(θ) → −1, sin(θ) → 0. Although the function is not defined at θ = π, we find
that
  cos(θ)
cos(θ) + sin(θ) sin(θ)
e = lim for 3π
4 <θ < 2

(5)
θ→π cos(θ)
or equivalently,
e = lim (1 + tan(θ))cot(θ) for 3π
4 <θ< 3π
2 . (6)
θ→π

In the same manner, we can set the functions f (x) = cot(θ) and g(x) = tan(θ).
As θ approaches π from below, cot(θ) → −∞ and tan(θ) → 0. As θ approaches π
from above, cot(θ) → ∞ while tan(θ) → 0. Substituting these functions in (4) and
using trigonometric identities we arrive at
cot2 (θ)
e = lim sec2 (θ) for π
2 <θ< 3π
2 . (7)
θ→π

It should be noted that it is not necessary to begin with GCM. The same
method of derivation can be applied to other closed-form approximations (Brothers
& Knox, 1998; Knox & Brothers, 1999; Richardson & Gaunt, 1927).
To assess the relative rates of convergence for these expressions it is possible to
generate their respective power series (see Brothers & Knox; Knox & Brothers) by
replacing θ with π ± 1/x and then evaluating the expression as x → ∞. For (6) and
(7) the associated power series when approaching π from below are, respectively,

cot(π−(1/x)) 1 11 29
(1 + tan (π − (1/x))) = e 1+ + 2
+
2x 24x 48x3
  (8)
4207 1 4
+ 4
+O , x>
5760x x5 π

The AMATYC Review Volume 30, Number 1


Harlan J. Brothers 31

a first-order approximation, and in alternative form,



2 −1 1 1 11
sec (π − (1/x))(sec (π−(1/x))−1)
2
= e 1− 2
+ 4−
2x 8x 728x6
  (9)
19 1 2
+ −O , x>
13440x8 x10 π

which, as confirmed by the RHS, is a second-order approximation.


Dozens of trigonometric approximations to e can be derived in the manner
described. Many of these functions map to C over at least some portion of the
interval [0, 2π]. For example, the following form has the interesting
√ property that in
addition to converging to e as θ → π, it also converges to 2 at 5π/4 and to 1 at
3π/2 (see Figure 1 below and Figure 2 on page 32):

e = lim (− sin(θ) − cos(θ))cot(θ) for 3π


4 <θ< 7π
4 (10)
θ→π

Figure 1: Graph of the Real output of the function f (θ) =


(− sin (θ) − cos (θ))cot(θ) for 3π/4 < θ < 11π/4 with removable sin-
gularities at π and 2π. This function maps to R for 3π/4 < θ < 7π/4
and to C for 7π/4 < θ < 11π/4. √ It is undefined at θ = 3π/4 and
θ = 7π/4 and Real at (9π/4, − 2) and (5π/2, 1).

Similar approximations can also be derived so as to converge for π/2. Higher-


order approximations can also be achieved in the same fashion. A more extensive
list of trigonometric expressions for e can be found at (Brothers).

Fall 2008 The AMATYC Review


32 How to Design Your Own π to e Converter

Figure 2: 3D scatter plot of the function in Figure 1 revealing the


Imaginary component for 7π/4 < θ < 11π/4. The modulus of the
complex region approaches e as θ → 2π.

The π to e converter
Because the above functions provide a direct link between the numerical values
of these two constants, using a computer algebra program or arbitrary precision
library one can write a procedure that takes a given number of the digits of π and,
from them, derives digits of e. Here is sample Mathematica ® code based on the
first-order approximation in (6):
$MaxExtraPrecision 10000; power 1;
power Cot power
func _ : 1 Tan
numDigits 12; extraPlaces 0; acc power numDigits extraPlaces;
piDigits Flatten Drop RealDigits , 10, numDigits , 1 ;
piNum FromDigits piDigits ;
eValue N func piNum 10numDigits 1 , acc ;
Print "Input digits ", numDigits, " digit accuracy ", piDigits
If extraPlaces 0, Print " ", numDigits extraPlaces, " digit accuracy
", N , numDigits extraPlaces
Print " ", acc, " digit accuracy ", actualE N E, acc
Print "Output ", acc, " digit accuracy ", eValue
Print "Error ", N FromDigits RealDigits actualE , acc
N FromDigits RealDigits eValue , acc

The AMATYC Review Volume 30, Number 1


Harlan J. Brothers 33

Using the variable numDigits, this program takes the first n digits of π as its
input, rounded to n digit accuracy (d.a.). It outputs the actual value of e (at n d.a.)
along with the computed value and the error, expressed as e minus the computed
value. For the first-order approximation (6), inputting the first twelve digits of π
yields the first 12 digits of e (at 12 d.a.).
Higher-order approximations can also be tested with the program. For exam-
ple, using trigonometric identities, the second-order approximation in (7) can be
rewritten as
cot2 (θ)
e = lim 1 + tan2 (θ) . (11)
θ→π

Setting the variable power = 2 and using the same 12 digit input yields 24 digits
of e. In general, the number of accurate digits obtained is proportional to order of
accuracy of the approximation’s associated power series; a kth order approximation
returns approximately k times the number of digits that are input.
The decimal place accuracy of the output (the number of accurate digits to the
right of the decimal point) can be directly approximated using the log of the error
term in the approximation’s associated power series (see equations (8) and (9)):
j  a k
d.p.a. ≈ −Log10 (12)
bxn
where a, b, and n are constants and “b c” denotes the floor function. Let Pa equal
the actual value of π and let Pr equal the input value rounded to n d.a.. The value
of x is then calculated according to

x = 1/(Pa − Pr ). (13)

It is interesting to note that certain inputs are inherently more accurate at any
order. Because the function f is defined by the limit e = limθ→π f (θ), it converges as
|Pa − Pr | → 0. Rounding error therefore changes according to the value of the digits
immediately following the specific number of digits chosen for input. Remembering
that the first digit of π occurs to the left of the decimal point, if we denote the
maximum possible rounding error by ε, then at any given value of accuracy n,
ε = 5 × 10−n + C × 10−(n+1) , for C < 1 as C → 0. The maximum error in the
converted value therefore occurs when |Pa − Pr | = ε. Conversely, minimum error
occurs when |Pa − Pr | < 1 × 10−n .
For any arbitrary number of input digits, the potential range in accuracy is
equal to (|Pa − Pr |max − |Pa − Pr |min ). This is simply ε, which to one d.p.a. in the
nth decimal place is equal to 0.5. For the function in (8), the error term in its power
series is (1/2x). Evaluating this term with x = 1/(0.5) (see Eq. 13), we find that the

Fall 2008 The AMATYC Review


34 How to Design Your Own π to e Converter

maximum potential error η in the estimation of the overall d.p.a. of the function is
equal to
η = − Log10 14 ≈ 0.6 (14)


Referring back to the above code, the maximum decimal place error (m.d.p.e.)
for this function (and its higher-order cousins) can therefore be closely estimated by
m.d.p.e. ≈ 35 · power where “d e” denotes the ceiling function. At maximum error,


the minimum accuracy is then given by d.p.a ≈ numDigits*power − 53 · power .


 

Using a non-zero value for the variable extraPlaces allows one to compare the
values of Pa and Pr .

Conclusion
It should be noted that using π to generate the digits e is not very “practical.”
The simple fact that one needs to first calculate trigonometric values to be used
as part of the overall calculation severely limits efficiency in a computational sense.
Clearly, if armed only with pencil and paper, there are easier ways to calculate e
using infinite series (Brothers, 2004). Nonetheless, these unexpected expressions
appear interesting in their own right and provide fertile territory for exploration and
research by first- and second-year calculus students. Indeed, students can use the
methods presented here to produce their own original results, reinforcing the intimate
link between two numbers that have fascinated mathematicians for centuries.

References
Anton, H. (1980). Calculus. New York: John Wiley & Sons.
Bradley, G. L. & Smith, K. J.. (1999). Single variable calculus. (2nd ed.). Baskin-Ridge,
NJ: Prentice-Hall.
Brothers, H. J. (2004). Improving the convergence of Newton’s series approximation for e.
The College Mathematics Journal, 35 (1), 34–39.
Brothers, H. J. http://www.brotherstechnology.com/math/converter.html.
Brothers, H. J. & Knox, J. A. (1998). New closed-form approximations to the logarithmic
constant e. The Mathematical Intelligencer, 20 (4), 25–29.
Knox, J. A. & Brothers, H. J. (1999) Novel series-based approximations to e. The College
Mathematics Journal, 30 (4), 269-275.
Maor, E. (1994), e: The story of a number. Princeton, NJ: Princeton University Press.
Richardson, L. F. & Gaunt, J. A. (1927). The deferred approach to the limit. Philosophical
Transactions of the Royal Society of London, series A, 226.

The AMATYC Review Volume 30, Number 1


Harlan J. Brothers 35

Acknowledgments
This paper would not have been possible without the support and encouragement of
Professor John Knox, University of Georgia. His initial interest and subsequent devotion
to the development of series-based approximations for e provided the foundation for this
work. The author is grateful to Professor Miguel Garcia of Gateway Community College in
Connecticut for his unflagging interest and encouragement. Thanks also to Robert Speiser at
Brigham Young University for his editorial expertise. Mathematica is a registered trademark
of Wolfram Research, Inc.

Lucky Larry #91


Solve the equation (x − 1) (3x + 2) = 4x.
Larry’s solution:

(x − 1) (3x + 2) = 4x
x − 1 = 4x or 3x + 2 = 4x
−1 = 3x or 2=x
−1
= x or 2 = x
3
−1
n o
Solution set = ,2
3

Michael W. Lanstrum
Cuyahoga Community College
Parma, OH

Neglect of mathematics works injury to all knowledge, since one who is ignorant of it
cannot know the other sciences of the things of this world. And what is worst, those
who are thus ignorant are unable to perceive their own ignorance and so do not seek
a remedy.
Roger Bacon

I must study politics and war that my sons may have liberty to study mathematics and
philosophy. My sons ought to study mathematics and philosophy, geography, natural
history, naval architecture, navigation, commerce and agriculture in order to give their
children a right to study painting, poetry, music, architecture, statuary, tapestry, and
porcelain.
John Adams (1735–1826)
Letter to Abigail Adams, May 12, 1780

Fall 2008 The AMATYC Review

You might also like