0% found this document useful (0 votes)
109 views

Hw2ans PDF

The document contains the answers to 7 problems in a numerical analysis homework assignment. Problem 1 involves rounding computations and determining which is a better approximation. Problem 2 finds rates of convergence of various functions as a parameter approaches a limit. Problems 3-7 use techniques like Taylor series, bisection method, and algebraic manipulations to solve equations or show relationships between functions and their fixed points.

Uploaded by

Amina Tabassum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Hw2ans PDF

The document contains the answers to 7 problems in a numerical analysis homework assignment. Problem 1 involves rounding computations and determining which is a better approximation. Problem 2 finds rates of convergence of various functions as a parameter approaches a limit. Problems 3-7 use techniques like Taylor series, bisection method, and algebraic manipulations to solve equations or show relationships between functions and their fixed points.

Uploaded by

Amina Tabassum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MT414: Numerical Analysis

Homework 2
Answers

1. Let a = 0.96 and b = 0.99.


a+b
(a) Using two-digit rounding arithmetic, compute .
2
b−a
(b) Using two-digit rounding arithmetic, compute a + .
2
a+b
(c) Which of these two values is a better approximation to the actual value of ?
2
Answer: (a) We compute that a + b rounds to 2.0 using two-digit rounding arithmetic,
a+b
and therefore rounds to 1.0.
2
b−a
(b) Now, we compute that rounds to 0.015, and a + 0.15 rounds to 0.98.
2
(c) The result in (b) is considerably better than that in (a), because it is between the
values of a and b. The other result could lead to serious errors.

2. Find the rates of convergence of the following functions as n → ∞:


1 1
a. lim sin = 0 b. lim sin 2 = 0
n→∞
 n 2 n→∞ n
1
c. lim sin =0 d. lim log(n + 1) − log(n) = 0
n→∞ n n→∞

Answer: The first three problems can be answered much more easily if we know that
sin x ≤ x for 0 ≤ x < 1.  (Much more than this is true, but this inequality
 suffices.)
1 As a
1 1 1 1 1
result, we have | sin n | < n , and so sin n = O( n ). Similarly, | sin n2 | < n2 , and so

1
sin n2 = O( n2 ). We also can take the inequality | sin n | < n1 and square both sides,
1 1

2
giving | sin n1 |2 < n12 , and therefore sin n1 = O( n12 ).


The last one is a bit more interesting. We rewrite log(n+1)−log(n) as log 1 + n1 , and


now use the fact that | log(1 + x)| < |x| for 0 < x < 1. Therefore, | log(n + 1) − log(n)| < n1 ,
and so log(n + 1) − log(n) = O( n1 ).

3. Find the rates of convergence of the following functions as h → 0:


sin h 1 − cos h
a. lim =1 b. lim =0
h→0 h h→0 h
sin h − h cos h 1 − eh
c. lim =0 d. lim = −1
h→0 h h→0 h
Answer: Here, Maclaurin series are the easiest way to get a solution:
3
sin h h − h6 + · · · h2
= =1− +···
h h 6
sin h
and so h = 1 + O(h2 ).
For b, we have
2
1 − cos h 1 − (1 − h2 + · · ·) h
= = + ···,
h h 2
1−cos h
so h = O(h).
For c, we have
h3 h2
sin h − h cos h (h − 6 + · · ·) − h(1 − 4 + · · ·) −h2 h2
= = +
h h 6 4
sin h−h cos h
so h
= O(h2 ).
Finally, for d, we have
h2
1 − eh 1 − (1 + h + 2
+ · · ·) h
= = −1 − + ···,
h h 2
1−eh
so h
= −1 + O(h).

4. Suppose that 0 < q < p and αn = α + O(n−p ). Show that αn = α + O(n−q ).


Answer: The definition says that for sufficiently large n and for some positive constant K,
|αn − α| < Kn−p . Because q < p, we know that n−p < n−q . Therefore, |αn − α| < Kn−q ,
which in turn says that αn = α + O(n−q ).

5. Suppose that 0 < q < p and F (h) = L + O(hp ). Show that F (h) = L + O(hq ).
Answer: The definition says that for sufficiently small positive real numbers h and some
positive constant K, |F (h) − L| < K|hp |. Again, because q < p and |h| < 1, |hp | < |hq |.
This means that |F (h) − L| < K|hq |, which in turn means that F (h) = L + O(hq ).

6. Use the bisection method to find a solution accurate to within 0.01 for the equation
x4 − 2x3 − 4x2 + 4x + 4 = 0 on the interval [−1, 4].
Answer: Here is a chart of the results, with a the left-hand endpoint of the bounding
interval, b the right-hand endpoint of the bounding interval, and m the midpoint of the
bounding interval at each stage:
n a b m f (m)
1 −1 4 1.5000 −0.6875
2 1.5000 4 2.7500 0.3477
3 1.5000 2.7500 2.1250 −4.3630
4 2.1250 2.7500 2.4375 −3.6797
5 2.4375 2.7500 2.5938 −2.1745
6 2.5938 2.7500 2.6719 −1.0526
7 2.6719 2.7500 2.7109 −0.3888
8 2.7109 2.7500 2.7305 −0.0299
9 2.7305 2.7500 2.7402 0.1565
10 2.7305 2.7402 2.7354 0.0627
This tells us that a root is between 2.7305 and 2.7354.

7. Let f (x) = x4 + 2x2 − x − 3. Use algebraic manipulations to show that each of the
following functions has a fixed point at p if and only if f (p) = 0:
1/2
x + 3 − x4

2 1/4
a. g1 (x) = (3 + x − 2x ) b. g2 (x) =
2
1/2
3x + 2x2 + 3
4

x+3
c. g3 (x) = d. g 4 (x) =
x2 + 2 4x3 + 4x − 1
Answer: (a) Start with x4 + 2x2 − x − 3 = 0, and move the last three terms to the right-
hand side of the equation, yielding x4 = −2x2 + x + 3. Take fourth roots, and we have
x = (3 + x − 2x2 )1/4 . So a fixed point of g1 (x) = (3 + x − 2x2 )1/4 will be a root of the
original equation. The algebra here is reversible, yielding the “if and only if” conclusion.
(b) Start with x4 + 2x2 − x − 3 = 0, and now move all but the quadratic term to the
right-hand side of the equation, yielding 2x2 = −x4 + x + 3. Divide by 2 and take square
roots to get x = ((3 + x − x4 )/2)1/2 . Again, we can see that this process is reversible.
(c) Start with x4 + 2x2 − x − 3 = 0, and move the last two terms to the right-hand
side, yielding x4 + 2x2 = x + 3. Factor the left-hand side into x2 (x2 + 2), divide by x2 + 2,
and take square roots, and we get x = ((x + 3)/(x2 + 2))1/2 .
(d ) This is Newton’s method in disguise. Start with x4 + 2x2 − x − 3 = 0, and divide
both sides by −(4x3 + 4x − 1), yielding −(x4 + 2x2 − x − 3)/(4x3 + 4x − 1) = 0. Now add
x to both sides, yielding x − (x4 + 2x2 − x − 3)/(4x3 + 4x − 1) = x. Simplify the left-hand
side, and we get (3x4 + 2x2 + 3)/(4x3 + 4x − 1) = x. Again, the process is reversible.

8. Use the functions gk (x) in the previous problem and perform four iterations (if possible,
without dividing by 0 or taking the square root of a negative number), starting with p0 = 1
and gk (pn ) = pn+1 . Which of the four functions seems to give the best approximation to
a solution of the equation f (x) = 0?
Answer: I computed the following:

n g1 (pn ) g2 (pn ) g3 (pn ) g4 (pn )


0 1.1892 1.2247 1.1547 1.1429
1 1.0801 0.9937 1.1164 1.1245
2 1.1497 1.2286 1.1261 1.1241
3 1.1078 0.9875 1.1236 1.1241
4 1.1339 1.2322 1.1242 1.1241

Clearly, g4 (x) is converging to the fixed point quicker than any of the other three
functions.

You might also like