360 likes | 469 Views
MA2213 Lecture 1. Rootfinding. Class Schedule. Tuesday 2-4 in LT31 (building S16). Lectures:. Friday 2-4 in LT31 (building S16). Groups:. Class will be divided into 5 groups. Each group (of about 25 students) will:. do tutorials and labs together.
E N D
MA2213 Lecture 1 Rootfinding
Class Schedule Tuesday 2-4 in LT31 (building S16) Lectures: Friday 2-4 in LT31 (building S16) Groups: Class will be divided into 5 groups Each group (of about 25 students) will: do tutorials and labs together be assigned a person who will supervise both tutorials and labs, and grade written homework Tutorials: will meet in weeks 3,5,7,9,11 Labs: will meet in weeks 4,6,8,10,12 (more information will be announced soon)
Suggestions Use the Module IVLE Website Attend lectures, tutorials, and labs Do: Purchase the required textbook Study the textbook and work problems Complete assigned homework and give to your grader during tutorials and labs Do Not: Send or give me assigned homework Email me questions whose answers are on the Module IVLE Website
Objectives and Prerequisites Numerical Methods Learn Accuracy and Errors Computer Algorithms (MATLAB) Prerequisites Real Numbers and Complex Numbers Calculus Fundamental Theorem of Algebra Fundamental Theorems of Calculus Linear Algebra Linear Equations: Geometry and Matrix Algebra Vector Spaces and Linear Transformations
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
Lecture Schedule Dates Lecture # Topic 1 Rootfinding 14, 17 Aug 2 Interpolation 21, 24 Aug 3 Approximation 28, 31 Aug 4 Numerical Integration 4, 7 Sept 5 Linear Equations (Direct) 11, 14 Sept 6 Linear Equations (Iterative) 18, 21 Sept Recess Week 24-28 Sept Review and Midterm Test 2, 5 Oct
Lecture Schedule Dates Lecture # Topic 7 Eigenvalues 9, 12 Oct 8 Nonlinear Systems 16, 19 Oct 9 ODE (Explicit) 23, 26 Oct 10 ODE (Implicit) 30 Oct, 2 Nov 11 PDE 6, 9 Nov 12 Review 13, 16 Nov EXAM : Friday, 30 Nov 200(MORNING)
Retirement Planning Amount deposited at beginning of each of is paid per period. time periods. Interest (pages 71-72) End of Period Amount of Money in the Account
Retirement Planning Specifying and the value of in terms of the value of suffices to write (pages 71-72) 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
Retirement Planning 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 (pages 71-72) 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’)
Retirement Planning 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 (pages 71-72)
Retirement Planning 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 (pages 71-72)
Retirement Planning An algebraic calculation gives (pages 71-72) We now derive a closed expression for Case 1. Case 2.
Retirement Planning At the end of period ,beginning of period payments each of we withdraw the first of (pages 71-72) to leave 0 after the last withdrawal. amount Withdrawal # Amount After Withdrawal
Retirement Planning Therefore, the method for geometric series gives (pages 71-72) substituting for then gives therefore if and then is a root of the retirement polynomial
Retirement Polynomial then is a root of If the polynomial therefore, the quadratic formula gives since
Retirement Polynomial Result: If then there exists is a root of the retirement poly so that We first factorize Then we observe that and
Retirement Polynomial Example What is the minimal monthly interest rate to support the following retirement dream then
Ancient Rootfinding • Problem : Given a function f(x), find x* such that f(x*) = 0. Example. Compute • Example : The Babylonian clay tablet YBC 7289 (c. 2000–1650 BC) gives an approximation of x* = in four sexagesimal figures, which is about six decimal figures
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 Observation: If then (1) or (2) or (3) there exists a x* in (a,m) such that f(x*) = 0 (1) midpoint there exists a x* in (m,b) such that f(x*) = 0 (2) (3) a root is found
Bisection Method (pages 72-79) then compute sequence If For k = 2:N If else
Bisection Method (pages 72-79) it computes such that At the algorithm executes the “k = N” instruction there exists such that Therefore, the computed root satisfies Question: How large should N be chosen to be ? Question: How large will the residual |f(x*)| be ?
Bisection Method (pages 72-79) Find root of in the interval
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 ?
Newton’s Method (pages 79-89) Observation: Clearly Question: How should we compute ? Question: What happens if f(x) = ax + b ?
Newton’s Method (pages 79-89) Question: How should we compute ? We see a GENERAL PATTERN
Newton’s Method (pages 79-89) Question: What happens if f(x) = ax + b ? for ANY starting value for
Newton’s Method (pages 79-89) Find root of Solution: The iteration is
Newton’s Method (pages 79-89) Find root of Question Why should ? Question When would this algorithm be useful ?
Taylor’s Polynomial (pages 2-11) Definition If has derivatives on and then the polynomial is called the degree n Taylor Polynomial of f at a. Example the degree 2 Taylor Polynomial at 2 is
Taylor’s Polynomial (pages 2-11) BLUE 1+x^3 GREEN Taylor Polynomial
Error in Taylor Polynomial (pages 11-23) Theorem If has n+1 continuous derivatives on and and is the an interval degree n Taylor Polynomial for at then 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
Error Analysis (pages 83-86) Theorem Assume that has 2 continuous derivatives on an interval and and for every and LB < 2 where Then for every Newton’s algorithm starting at gives a sequence whose error sequence satisfies and therefore converges to
Error Analysis (pages 83-86) Proof If then the degree 2 at satisfies Taylor Polynomial for where Newton’s Method gives therefore the errors satisfy hence complete the proof!
Questions for Thought and Discussion What are advantages of Newton’s method? What are disadvantages of Newton’s method? How can the Bisection Method and Newton’s Method be combined to produce a method that has advantages of both ?
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 Extra Credit Use the following formula to derive a ‘closed form’ upper bound for Discuss with your tutor the “Questions for Thought and Discussion” Suggested Reading: pages 71-89, Appendix A. Mean Value Theorems Appendix D. MATLAB: An Introduction