Homework 1
Numerical Analysis (CMPS/MATH 305)
Hani Mehrpouyan
Homework 1 Solution
Q UESTION 1 (5 POINTS )
Produce the linear and quadratic Taylor polynomials for the following cases. Graph the function and these Taylor
polynomials.
a) f (x) =
x, a = 1
b) f (x) = sin(x), a = /4
c) f (x) = ecos(x) , a = 0
d) f (x) = log(1 + ex ) , a = 0
Q UESTION 2 (5 POINTS )
Produce a general formula for the degree n Taylor polynomials for the following functions, all using a = 0 as the
point of approximation.
a) 1/(1 x)
b) (1 + x)1/3
c) 1 + x
Q UESTION 3 (5 POINTS )
Compare f (x) = sin(x) with its Taylor polynomials of degrees 1, 3, and 5 on the interval /2 x ; a = 0.
Produce a Matlab plot or a table in the manner of Table 1.1.
Q UESTION 4 (5 POINTS )
The quotient g(x) =
ex 1
x
is undefined for x = 0. Approximate ex by using Taylor polynomials of degrees 1,2,
and 3, in turn, to determine a natural definition of g(0).
Q UESTION 5 (5 POINTS )
a) As an alternative to the linear Taylor polynomial, construct a linear polynomial q(x), satisfying q(a) = f (a),
q(b) = f (b) for given points a and b.
b) Apply this to f (x) = ex with a = 0 and b = 1. For 0 x 1, numerically compare q(x) with the linear Taylor
polynomial of this section.
Q UESTION 6 (5 POINTS )
Find the degree 2 Taylor polynomial for f (x) = ex sin(x), about the point a = 0. Bound the error in this
approximation when /4 x /4.
Q UESTION 7(5
POINTS )
Let Pn (x) be the Taylor polynomial of degree n of the function f (x) = log(1 x) about a = 0. How large should
n be chosen to have |f (x) Pn (x)| 104 for 1/2 < x < 1/2? For 1 < x < 1/2?
Q UESTION 8 (5 POINTS )
Use Taylor polynomials with remainder term to evaluate the following limits:
1 cos(x)
,
x2
log(1 + x2 )
b) x0
,
2x
log(1 x) + xex/2
c) lim
.
x0
x3
a) lim
x0
(Hint: Use Taylor polynomials for the standard functions [e.g., cos(t), log(1 + t), and et ] to obtain polynomial
approximations to the numerators of these fractions; and then simplify the results.)
Q UESTION 9 (5 POINTS )
Z1
Evaluate I =
0
ex 1
x within an accuracy of 106 .
x
(Hint: Replace ex by a general Taylor polynomial approximation p]us its remainder)
10
Q UESTION 10 (5
Zx
Define f (x) =
POINTS )
log(1 + t)
x
t
a) Give a Taylor polynomial approximation to f (x) about x = 0,
b) Bound the error in the degree n approximation for |x| 1/2,
c) Find n so as to have a Taylor approximation with an error of at most 107 on [1/2, 1/2].
11
Q UESTION 11 (5
POINTS )
Evaluate
p(x) = 1
x3 x6 x9 x12 x15
+
,
3!
6!
9!
12!
15!
as efficiently as possible. How many multiplications are necessary? Assume all coefficients have been computed
and stored for later use.