Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Maths 270: Numerical Computation

Assignment 1

2022

Questions

Q1.   (a) Use Matlab to calculate 540 . What do you notice? (Hint: it may be useful to calculate 52 , 53 , 54 ...520 , first, and then compare.  The command format bank may be useful for viewing your numbers.)

(b) Use Matlab to calculate 540 + 17. What do you notice?

(c) Give a one or two sentence explanation of WHY you see what you do here.

(d) What is the next storable number after“540”? (Hint: the Matlab command‘eps’might be helpful. If you don’t know how to use it, use ’help eps’. Here we use“540”to denote Matlab’s approximation of 540 .)

(e) Based on your answers above, calculate upper bounds on the absolute and relative

error associated with storing“540 ”(matlab uses symmetric rounding, not truncation). [10 marks]

For questions 2 and 3 below, consider the equation

f(x) = ex − 3 * x2

Q2.   (a) Provide evidence that f(x) has exactly three roots on the domain (−∞ , ∞) using

Intermediate value theorem. Also, support your answer by drawing a labelled graph within a reasonable interval for the given function.

(b) Find an interval [a,b] of length 1, which contains the most positive root x+ .

(c) Using the bisection method, is it possible to pick an n (number of iterations) such that we can be sure |xn − x+ | < 10 7 ? If yes, what is the value of n. If no, why not? Justify your claim without using MATLAB.

(d) Using the bisection method, starting with your interval from 2(b), is it possible to find an interval of width 1/16 such that this interval contains x+ . If yes, what is that interval? If no, why not? Justify your claim without using MATLAB.

(e) Code the bisection method into MATLAB and use it to approximate x+  as in 2(c).

Hand in both your code and your approximation. [15 marks]

Q3.          In this part, we will use the fixed-point method to find the most negative root x−  of

f(x) = e − 3x2

(a) Give three different rearrangements of f(x) = 0 into the form x  = g(x).   Notice

how some of these rearrangements manage to‘lose’solutions (there are values where f(x) = 0 but g(x)  x). Why is this?

(b) Select one of your rearrangements and determine an associated interval [a,b] containing

the most negative root x. Show the criteria of Theorem 1 on page 30 of the textbook are satisfied.

Hint: A well labelled graph with appropriate explanatory text will suffice.

(c) Provide an estimate of the convergence rate K so you can predict how fast the iteration will converge.

(d) Using the fixed point method and one of the rearrangements found above, use MAT- LAB to approximate x such that |f(x)| < 10 7 . How many iterations are needed to achieve this accuracy? Hand in both your code and your approximation.

(e) Choose a single starting value x0  and use your MATLAB code obtained in 2(d) to

show numerically that different rearrangements can converge to different roots of f(x). Support your answers with a plot xn  vs n.

(f) Think about two classes of tests we can use to check our approximate solutions: X-

test and F -test.  Apply both tests to approximate x−  starting with an initial guess x0  = 0. What inferences do you make based on your analysis?

Q4. Bonus question (zero marks)

Newton-Raphson method can also be thought of as an iterative scheme, with some it- eration function xn+1  = f(xn ).

(a) Derive the Newton-Raphson method to find 1/N, where N > 0.  Hence, find 1/17

using the initial approximation as (i) 0.05, (ii) 0.15.

(b) Do the iterations converge in both cases? Explain.

(c) Comment on how these initial approximations affect the convergence rate. [0 marks]