Homework 1 Numerical Analysis (CMPS/MATH 305) · Homework 1 Numerical Analysis (CMPS/MATH 305) Hani...
Transcript of Homework 1 Numerical Analysis (CMPS/MATH 305) · Homework 1 Numerical Analysis (CMPS/MATH 305) Hani...
Homework 1
Numerical Analysis (CMPS/MATH 305)
Hani Mehrpouyan
Homework 1 Solution
QUESTION 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
1
QUESTION 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
2
QUESTION 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.
3
QUESTION 4 (5 POINTS)
The quotient g(x) = ex−1x 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).
4
QUESTION 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.
5
QUESTION 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.
6
QUESTION 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)| ≤ 10−4 for −1/2 < x < 1/2? For −1 < x < 1/2?
7
QUESTION 8 (5 POINTS)
Use Taylor polynomials with remainder term to evaluate the following limits:
a) limx→0
1− cos(x)
x2,
b) x→0log(1 + x2)
2x,
c) limx→0
log(1− x) + xex/2
x3.
(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.)
8
9
QUESTION 9 (5 POINTS)
Evaluate I =
1∫0
ex − 1
x∂x within an accuracy of 10−6.
(Hint: Replace ex by a general Taylor polynomial approximation p]us its remainder)
10
QUESTION 10 (5 POINTS)
Define f(x) =
x∫0
log(1 + t)
t∂x
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 10−7 on [−1/2, 1/2].
11
QUESTION 11 (5 POINTS)
Evaluate
p(x) = 1− x3
3!+x6
6!− x9
9!+x12
12!− x15
15!,
as efficiently as possible. How many multiplications are necessary? Assume all coefficients have been computed
and stored for later use.