Presentation is loading. Please wait.

Presentation is loading. Please wait.

MA2213 Lecture 1 Rootfinding. Class Schedule Lectures: Tuesday 2-4 in LT31 (building S16) Groups:Class will be divided into 5 groups Each group (of about.

Similar presentations


Presentation on theme: "MA2213 Lecture 1 Rootfinding. Class Schedule Lectures: Tuesday 2-4 in LT31 (building S16) Groups:Class will be divided into 5 groups Each group (of about."— Presentation transcript:

1 MA2213 Lecture 1 Rootfinding

2 Class Schedule Lectures: Tuesday 2-4 in LT31 (building S16) Groups:Class will be divided into 5 groups Each group (of about 25 students) will: Tutorials: will meet in weeks 3,5,7,9,11 Labs: will meet in weeks 4,6,8,10,12 do tutorials and labs together Friday 2-4 in LT31 (building S16) be assigned a person who will supervise both tutorials and labs, and grade written homework (more information will be announced soon)

3 Suggestions Do: Attend lectures, tutorials, and labs Complete assigned homework and give to your grader during tutorials and labs Do Not: Send or give me assigned homework Study the textbook and work problems Use the Module IVLE Website Email me questions whose answers are on the Module IVLE Website Purchase the required textbook

4 Objectives and Prerequisites Learn Numerical Methods Accuracy and Errors Computer Algorithms (MATLAB) Calculus Real Numbers and Complex Numbers Fundamental Theorem of Algebra Fundamental Theorems of Calculus Linear Equations: Geometry and Matrix Algebra Vector Spaces and Linear Transformations Linear Algebra Prerequisites

5 Required Textbook Elementary Numerical Methods by Atkinson and Han About 20 books are now in the Science COOP (due to limited shelve space) but more books will be transferred from the warehouse) Homework (Tutorial and Lab) may be assigned from this textbook Suggested Reading from this textbook Appendix A&B Math Rev, D MATLAB

6 Lecture Schedule 1 Rootfinding14, 17 Aug 2 Interpolation21, 24 Aug 3 Approximation28, 31 Aug 4 Numerical Integration4, 7 Sept 5 Linear Equations (Direct) 11, 14 Sept 6 Linear Equations (Iterative) 18, 21 Sept Recess Week24-28 Sept Review and Midterm Test2, 5 Oct Lecture #Topic Dates

7 Lecture Schedule 7 Eigenvalues9, 12 Oct 8 Nonlinear Systems16, 19 Oct 9 ODE (Explicit) 23, 26 Oct 10 ODE (Implicit) 30 Oct, 2 Nov 11 PDE6, 9 Nov 12 Review13, 16 Nov Lecture #Topic Dates EXAM : Friday, 30 Nov 200 (MORNING)

8 Retirement Planning (pages 71-72) deposited at beginning of each of Amount time periods. Interest is paid per period. End of PeriodAmount of Money in the Account

9 Retirement Planning (pages 71-72) Specifying and the value of in terms of the value ofsuffices to write a computer program to compute The figure shows that if you deposited $1000 monthy at r = 0.0025 you would have $584,194 after 30 years

10 Retirement Planning (pages 71-72) Here is the smallest MATLAB code required function A = amount(Pin,Nin,r) A(1) = (1+r)*Pin; for k = 1:Nin-1 A(k+1) = (1+r)*A(k) + (1+r)*Pin; end you would write and store it in a m-file amount.m and then run it interactively using the commands: A = amount(1000,360,0.0025) plot(A); grid; xlabel(‘End of Period (Month)’) ylabel(‘Amount at end of Period’)

11 Retirement Planning (pages 71-72) But your grader will demand documented code function A = amount(Pin,Nin,r) % function A = amount(Pin,Nin,r) % % Wayne Lawton, Student Number: XXXXXX % MA2213, Homework Assignment 1 % Date: Tuesday 14 August 2007 % % Computes Amount of Money in an Interest Bearing Account % % Inputs: % Pin = input at beginning of each period % Nin = number of input periods % r = interest earned during each period % Outputs: % A = array of length Nin % A(k) = amounts at the end of the k-th period % A(1) = (1+r)*Pin; for k = 1:Nin-1 A(k+1) = (1+r)*A(k) + (1+r)*Pin; end

12 Retirement Planning (pages 71-72) Comments (start with %) are useful in interactive mode >> help amount function A = amount(Pin,Nin,r) Wayne Lawton, Student Number: XXXXXX MA2213, Homework Assignment 1 Date: Tuesday 14 August 2007 Computes Amount of Money in an Interest Bearing Account Inputs: Pin = input at beginning of each period Nin = number of input periods r = interest earned during each period Outputs: A = array of length Nin A(k) = amounts at the end of the k-th period

13 Retirement Planning (pages 71-72) An algebraic calculation gives We now derive a closed expression for Case 1. Case 2.

14 Retirement Planning (pages 71-72) At the end of period we withdraw the first of payments each of to leave 0 after the last withdrawal.,beginning of period amount Withdrawal #Amount After Withdrawal

15 Retirement Planning (pages 71-72) Therefore, the method for geometric series gives substituting forthen gives therefore ifandthen is a root of the retirement polynomial

16 Retirement Polynomial If thenis a root of therefore, the quadratic formula gives since the polynomial

17 Retirement Polynomial Result: If then there exists so that is a root of the retirement poly We first factorize Then we observe that and

18 Retirement Polynomial Example What is the minimal monthly interest rate to support the following retirement dream then

19 Ancient Rootfinding Problem : Given a function f(x), find x* such that f(x*) = 0. Example. Compute The Babylonian clay tablet YBC 7289 (c. 2000–1650 BC) gives an approximation of x* =Babylonian in four sexagesimal figures,sexagesimal which is about six decimal figures decimal Example :

20 Bisection Method (pages 72-79) Theorem: If f(x) is continuous in the interval [a,b] and, then there exists such that f(x*) = 0. Hence midpoint there exists a x* in (a,m) such that f(x*) = 0 Observation: If then (1) or (2) or (3) (2)  (1)  there exists a x* in (m,b) such that f(x*) = 0 (3)  a root is found

21 Bisection Method (pages 72-79) If then compute sequence For k = 2:N If else

22 Bisection Method (pages 72-79) At the algorithm executes the “k = N” instruction it computes Therefore, the computed root there exists such that satisfies Question: How large should N be chosen to be ? Question: How large will the residual |f(x*)| be ?

23 Bisection Method (pages 72-79) Find root ofin the interval

24 Questions for Thought and Discussion What are advantages of the bisection method? What are disadvantages of the bisection method? How could the bisection method be used to compute 1/y on a computer that could only add, subtract, and multiply ?

25 Newton’s Method (pages 79-89) Question: How should we compute Observation: Clearly ? Question: What happens if f(x) = ax + b ?

26 Newton’s Method (pages 79-89) Question: How should we compute? We see a GENERAL PATTERN

27 Newton’s Method (pages 79-89) Question: What happens if f(x) = ax + b ?  for ANY starting value for 

28 Newton’s Method (pages 79-89) Find root of Solution: The iteration is

29 Newton’s Method (pages 79-89) Find root of Question Why should? Question When would this algorithm be useful ?

30 Taylor’s Polynomial (pages 2-11) Definition Ifderivatives on is called the degree n Taylor Polynomial of f at a. has then the polynomial Example and the degree 2 Taylor Polynomial at 2 is

31 Taylor’s Polynomial (pages 2-11) BLUE 1+x^3 GREEN Taylor Polynomial

32 Error in Taylor Polynomial (pages 11-23) Theorem If an interval has n+1 continuous derivatives on degree n Taylor Polynomial for and atthen is the Taylor’s Remainder satisfies where (this means that c(x) is between a and x) Proof This very important result is proved in most Calculus textbooks, e.g. pages 1166-1167 in Thomas’ CALCULUS, Tenth International Edition

33 Error Analysis (pages 83-86) Theorem Assume that derivatives on an interval has 2 continuous Newton’s algorithm starting at and LB < 2 where and whose errorgives a sequence Then for every andfor every sequencesatisfies and thereforeconverges to

34 Error Analysis (pages 83-86) Newton’s Method gives at then the degree 2Proof If Taylor Polynomial for satisfies where therefore the errors satisfy hence complete the proof!

35 Questions for Thought and Discussion What are advantages of Newton’s method? How can the Bisection Method and Newton’s Method be combined to produce a method that has advantages of both ? What are disadvantages of Newton’s method?

36 Homework Due Tutorial 1 Question 1. Solve problem 1. a. on page 77 Question 2. Find the real root of the polynomial (in the previous question) using Newton’s method Suggested Reading: pages 71-89, Appendix A. Mean Value Theorems Appendix D. MATLAB: An Introduction Discuss with your tutor the “Questions for Thought and Discussion” Extra Credit Use the following formula to derive a ‘closed form’ upper bound for


Download ppt "MA2213 Lecture 1 Rootfinding. Class Schedule Lectures: Tuesday 2-4 in LT31 (building S16) Groups:Class will be divided into 5 groups Each group (of about."

Similar presentations


Ads by Google