10
Math 280: Numerical Analysis Midterm I October 7th, 2021 NAME (please print legibly): Your University ID Number: Your University email Pledge of Honesty Iarm that I will not give or receive any unauthorized help on this exam and that all work will be my own. Signature: The use of calculators beyond a simple numerical calculator, cell phones, iPods and other electronic devices at this exam is strictly forbidden. Show your work and justify your answers. You may not receive full credit for a correct answer if insucient work is shown or insucient justification is given. Put your answers in the spaces provided. You are responsible for checking that this exam has all 10 pages. QUESTION VALUE SCORE 1 20 2 10 3 10 4 20 5 20 TOTAL 80 SOLUTIONS

Math 280: Numerical Analysis

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Math 280: Numerical Analysis

Math 280: Numerical Analysis

Midterm I

October 7th, 2021

NAME (please print legibly):

Your University ID Number:

Your University email

Pledge of Honesty

I a�rm that I will not give or receive any unauthorized help on this exam and that all work

will be my own.

Signature:

• The use of calculators beyond a simple numerical calculator, cell phones,

iPods and other electronic devices at this exam is strictly forbidden.

• Show your work and justify your answers. You may not receive full credit

for a correct answer if insu�cient work is shown or insu�cient justification

is given.

• Put your answers in the spaces provided.

• You are responsible for checking that this exam has all 10 pages.

QUESTION VALUE SCORE

1 20

2 10

3 10

4 20

5 20

TOTAL 80

SOLUTIONS

Page 2: Math 280: Numerical Analysis

1. (20 points) Let {xn}, {yn}, and {↵n} be sequences.

(a) Prove that if xn = O(↵n) then xn = O(↵n).

(b) Give an example to show that the converse of the statement in (a) is not true (justify!).

(c) Prove that if xn = O(↵n) and yn = O(↵n) then xn + yn = O(↵n).

2

If I En o sit Ault En an I then I NS.t

En CI kn N Then Nhl EC al for MNwith an asymptotic constant of 2 11 so

m def xu Olan

An I 1 taut so Xu 0 a

But Ling In I 40 so Xu is not Olan

Yu talent for nan and lyn ECadal for non

lxutynlflxultly.nl E Glatt Glan Eclat

triangleinequality for u max Ni Naandfatch

so Xutyn Ola

Page 3: Math 280: Numerical Analysis

2. (10 points) The binary expansion of x = 45 is (0.110011001100...)2 = (0.1100)2.

(a) Find the machine numbers x� and x+ in F (2, 3,�10, 10), and determine which one is

closest to x .

(b) Find the absolute roundo↵ error associated to approximating x by the closest machine

number from (a) (express your answer as a fraction of the form 1n for integer n).

(c) Find the relative roundo↵ error associated to approximating x by the closest machine

number from (a) (express your answer as a fraction of the form 1n for integer n).

(d) Is 45 a machine number in F (2, 3,�10, 10)? Why or why not?

(e) What is the unit roundo↵ error in F (2, 3,�10, 10)?

3

F 2,3 10110 FdotEt E x2 di Oort loses lo

First write X as 1.1001100 2 2 9 24

It and 1 11.111210midpoint ttt fl lol x so Xisclosed

IX X 1 61100 y 24 4 24

I f

No X is the nearest machine number

and XIX

HIM t ÉÉms5

Page 4: Math 280: Numerical Analysis

3. (10 points) Consider a computer that uses the floating point number system F (2, 3,�10, 10)

and chopping (not rounding) to store real numbers as machine numbers (that is, fl(x) =

chop(x)).

(a) Consider the binary numbers x = (1.1111)2 and y = (1.1100)2. Compute the subtraction

x� y as real (binary) numbers.

(b) Compute x� y as machine numbers in the computer described above (that is, compute

fl(x)� fl(y)).

(c) Does loss of significance occur? Why or why not?

(d) The x and y from above satisfy 1 � yx ⇡ (0.09677 . . .)10. Give a bound on at least how

many and at most how many significant binary bits are lost in the subtraction x � y.

Does this match with your experience in part (b)? Why or why not?

4

X Y 0.0011 2

felt flly 1.1112 1.1112 0

yes X y feat fely l lx y1 4.11 53whereas Ix yEffett HEY L

So abs error is much smaller than rel error

0625 24 I 1 F E 2

31256 at most

4 and at least 3 significant digitsare lost

If we think of X y as 0.00110where the

last 3 digits are significant then yes

Page 5: Math 280: Numerical Analysis

4. (20 points) Consider the function f(x) = x2� 3.

(a) Show that f(x) has a unique real root in the interval [1, 3].

(b) Using the Bisection Method with the interval above [1, 3], how many steps would you

have to perform to approximate the root to with a relative error of 10�3?

(c) Perform one step of the Bisection Method. What is the resulting approximation to the

root of f(x)?

Problem continues on next page.

5

f is continuous anddifferentiable on IR

exist f i 2 and f 3 6 so by IVT f takeson every valve between 2 and he on C1,33in particular 2 0 and 670 so f has a root

If If fla o f b for a be 0,37 then by MVTF C ECaib s t O f b f a f c b a Nowf x 2X 0 on 1,33 so b a o be aSo f has a unique root in 113

LE 1,3 1471 HelIL Cnl s 2

na b al 2t2 2h

so 141e I so tf 153

when 2 I 103

or 2 71000 or he 10 steps

f 2 I O90 1 bo 3 Co 2

a I b 2 C 1 5

so the approximate root afterone

itemton is 11.57

Page 6: Math 280: Numerical Analysis

Problem continued from previous page.

(d) Find a simplified recursive formula for xn+1 for Newton’s Method, and perform one

iteration starting at x0 = 1. What is the resulting approximation to the root of f(x)?

(e) Find a simplified recursive formula for xn+1 for the Secant Method, and perform one

iteration starting with x0 = 1 and x1 = 2. What is the resulting approximation to the

root of f(x)?

(f) Which method gave the best approximation after one iteration? Did you expect this?

Why or why not? (Hint:p3 ⇡ 1.73205 . . .)

6

Xun Xu FEI Xu 4É Xiyu

x I x D

Xu Xu YI.tn nyflxn xn YIgcxi s

a

x 22114 541.6673

Secant method gave best appx This is to

beexpected since we used better startingvalves for Secant than bisection and one

step of secant is like two stepsof MentonIn the long him however Newton has the

fastest order of convergence so after manyiterations we'd expect Newton to pull ahead

Page 7: Math 280: Numerical Analysis

5. (20 points) Suppose f : [a, b] ! [a, b] is continuous on [a, b] and di↵erentiable on (a, b).

Suppose further that there exists a constant 0 < � < 1 such that |f 0(x)| � for all x in

[a, b].

(a) Show that f(x) has a unique fixed point s in [a, b] using The Contractive Mapping

Theorem: If F is a contractive mapping of a closed subset of the real line, C, back into

C then F has a unique fixed point.

(b) Show that a convergent sequence defined iteratively by xn+1 = f(xn) converges to s for

any initial seed x0 in [a, b].

Problem continues on next page.

7

LetXiy eCais Then f is continuous on x y anddifferentiable on yay so F c eCray s t

f x fly f c x y But c eCxy CECais

I k I s t If o e X by assumption

So 3 Aalst If x fly If Cal lx yl e d Ix y lso f is contractive on Carb and thus byCMT f has a unique fixedpoint s in Carb

let X Hy Xu forsome initial seedXo E a b

Because f a b a b andXoELaib byinduction Xue arb th Cab closed x eCab

f continuous

Then f x fl him Xu my f Xu Is Xue x

so x is a fixedpoint of f which by uniquenessmeans it equals s

Page 8: Math 280: Numerical Analysis

Problem continued from previous page.

(c) Write an iterative program (in pseudocode) that would find an approximation to this

fixed point.

(d) Show that, in the sequence defined by xn+1 = f(xn) with f as above, xn+1 is always a

better approximation to s than xn is.

8

x a

M 100

for I L M

x f xitt

endprint x

I Xnt s 1 1 f Xu f s def of Xnaand s a fixedp

A Xu SI f contractive

c Ix n st

se Xun is closer to s than Xu is

Page 9: Math 280: Numerical Analysis

Power of two Decimal expres-

sion

2�1 .5

2�2 .25

2�3 .125

2�4 .0625

2�5 .03125

2�6 .015625

2�7 .00078125

2�8 .000390625

2�9 .000195312

9

Page 10: Math 280: Numerical Analysis

Blank page for scratch work. Please put anything you want graded on earlier pages.

10