

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: NUMERICAL METHODS; Subject: MATHEMATICS; University: Texas A&M University; Term: Unknown 1989;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Instructors: Prof. Wolfgang Bangerth, Prof. Guido Kanschat [email protected], [email protected] Teaching Assistants: Seungil Kim, Yan Li [email protected], [email protected]
Problem 1 (Taylor series). Derive the first four terms and integral remain- der term of the Taylor series of
a) f (x) = cos x when expanded around x 0 = 0;
b) f (x) = x cos x when expanded around x 0 = π/2;
c) f (x) = 3(x − 4)^2 (x + 3) when expanded around x 0 = 1. What happened to the remainder term and what does this mean for the accuracy of the Taylor expansion with only four terms?
You may use a computer algebra system like Maple to compute derivatives of f (x), but not to generate the entire Taylor series. (4 points)
Problem 2 (Taylor series). Many important functions such as the sine can- not be computed in a simple way, i.e. with only the four basic operations plus, minus, multiplication and division. However, they can be approximated with these operations.
a) Graph the first eight Taylor approximations of f (x) = cos x when ex- panded around zero, i.e.
f 1 (x) = f (0) + f ′(0)x, f 2 (x) = f (0) + f ′(0)x + 12 f ′′(0)x^2 , f 3 (x) = f (0) + f ′(0)x + 12 f ′′(0)x^2 + (^) 3!^1 f ′′′(0)x^3 ,
etc. What do you observe? What does this mean for the approximation of f (2π)?
b) How large is the maximal error of the approximation on the interval [0, 2 π].
c) Write a program to experimentally determine the number of terms you need to approximate f (2π) = 1 to an accuracy of 10−^4 and 10−^12. (6 points)
Problem 3 (Associativity of addition). In exact arithmetic, the partial sums
k=
k
diverge as N → ∞. Write a program that keeps adding 1/k in single precision arithmetic (float, REAL*4) until the sum stays exactly the same. How can this happen? As a second exercise, consider the following reformulation of the problem: in exact arithmetic, the order in which we add up the numbers 1/k does not matter. Check what happens if your program computes the partial sums as follows:
j=
k=
10 j + k
where the terms in parentheses are added up first, before they are added to the global sum. Perform the outer summation until the value of the sum does not change anymore. Compare the result to what you got previously. Explain. (6 points)