Assignment 1 - Fall 2006 | Numerical Methods | MATH 417, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Assignment; Class: NUMERICAL METHODS; Subject: MATHEMATICS; University: Texas A&M University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-184
koofers-user-184 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MATH 417: Numerical Analysis
Instructors: Prof. Wolfgang Bangerth, Prof. Guido Kanschat
Teaching Assistants: Seungil Kim, Yan Li
Homework assignment 1 due 9/7/06 and 9/8/06
Problem 1 (Taylor series). Derive the first four terms and integral remain-
der term of the Taylor series of
a) f(x) = cos xwhen expanded around x0= 0;
b) f(x) = xcos xwhen expanded around x0=π/2;
c) f(x) = 3(x4)2(x+ 3) when expanded around x0= 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 xwhen ex-
panded around zero, i.e.
f1(x) = f(0) + f0(0)x,
f2(x) = f(0) + f0(0)x+1
2f00(0)x2,
f3(x) = f(0) + f0(0)x+1
2f00(0)x2+1
3! f000(0)x3,
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 104and 1012.
(6 points)
1
pf2

Partial preview of the text

Download Assignment 1 - Fall 2006 | Numerical Methods | MATH 417 and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

MATH 417: Numerical Analysis

Instructors: Prof. Wolfgang Bangerth, Prof. Guido Kanschat [email protected], [email protected] Teaching Assistants: Seungil Kim, Yan Li [email protected], [email protected]

Homework assignment 1 – due 9/7/06 and 9/8/

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

SN =

∑^ N

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:

S 10 N =

N∑ − 1

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)