Iteration
CSc 1253: Project # 3
Approximating e Using a Power Series
Out: 9/21
Due: 10/10 by 11:50 PM
Learning Objectives
•
Using Iteration
•
More on Writing Interactive Programs
Definition 1.
The number
e
is irrational; that is, it cannot be expressed
as a ratio of integers. Furthermore, it is transcendental; it is not a root of
any nonzero polynomial with rational coefficients. The numerical value of
e
truncated to 20 decimal places is 2.71828182845904523536.
The power series expansion of the function
f
(
x
) =
e
x
is given by the expres
sion:
e
x
=
∞
summationdisplay
i
=0
x
i
i
!
= 1 +
x
+
x
2
2!
+
x
3
3!
+
x
4
4!
+
· · ·
Approximating
e
0
.
1
using the first five terms of this power series gives,
e
0
.
1
= 1 + 0
.
1 +
0
.
01
2
+
0
.
001
6
+
0
.
0001
24
= 1
.
10517
The e Approximation Program
Write a program consisting of only the main function, called
e
approximator.cpp
.
When your program begins, the user is prompted to enter a number
x
rep
resenting the power to which
e
is to be raised and a positive integer
n
repre
senting the number of terms to be used in the approximation. Your program
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Staff
 Exponential Function, Taylor Series, Decimal, Duncan

Click to edit the document details