Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm.

Slides:



Advertisements
Similar presentations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Advertisements

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Open Methods Chapter 6 The Islamic University of Gaza
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Laplace Transform Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2008 by Douglas Wilhelm Harder.
Topics in Applied Mathematics Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Open Methods Chapter 6 The Islamic University of Gaza
Open Methods Chapter 6 The Islamic University of Gaza
Copyright © Cengage Learning. All rights reserved. 10 Introduction to the Derivative.
APPLICATIONS OF DIFFERENTIATION Newton’s Method In this section, we will learn: How to solve high-degree equations using Newton’s method. APPLICATIONS.
FP1: Chapter 2 Numerical Solutions of Equations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Algorithm design techniques
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Shortest Paths Introduction to Algorithms Shortest Paths CSE 680 Prof. Roger Crawfis.
SECTION 1.3 THE LIMIT OF A FUNCTION.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Intellectual Property 1 WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Intellectual Property Douglas Wilhelm.
CHAPTER 2 LIMITS AND DERIVATIVES. 2.2 The Limit of a Function LIMITS AND DERIVATIVES In this section, we will learn: About limits in general and about.
3208 Unit 2 Limits and Continuity
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Welcome to ECE 204 Numerical Methods for Computer Engineers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo.
Proof by Induction.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Binary Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Copyright © Cengage Learning. All rights reserved. 3 Introduction to the Derivative.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
LIMITS AND DERIVATIVES The Limit of a Function LIMITS AND DERIVATIVES In this section, we will learn: About limits in general and about numerical.
Problems with Floating-Point Representations Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright.
Numerical Methods.
Decimal Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
Double-Precision Floating-Point Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007.
Iteration Methods “Mini-Lecture” on a method to solve problems by iteration Ch. 4: (Nonlinear Oscillations & Chaos). Some nonlinear problems are solved.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Second-Order Differential
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Errors in Numerical Methods
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Complaints, Discipline and Enforcement 1 WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Professional Engineers.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 The tree data structure Outline In this topic, we will cover: –Definition of a tree data structure and its components –Concepts of: Root, internal, and.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 N -ary trees This topic quickly looks at a generalization of a binary tree, where each node has up to N children –Definition –Perfect N -ary trees –Complete.
1 Complete binary trees Outline Introducing complete binary trees –Background –Definitions –Examples –Logarithmic height –Array storage.
Open Addressing: Quadratic Probing
AVL Trees.
Outline Introducing perfect binary trees Definitions and examples
Do-while loops.
Newton’s Method and Its Extensions
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder. All rights reserved. ECE 204 Numerical Methods for Computer Engineers

Fixed-Point Iteration In this topic, we will look at: –how fixed-point iteration can be used to solve certain problems numerically, and –some of the various limitations of iterative numerical methods including: determining convergence, slow convergence, and non-convergence

Fixed-Point Iteration Everyone has at some point punched in an arbitrary number on a scientific calculator and started pushing one of the buttons We will look at two examples: sin and cos

Fixed-Point Iteration Starting with x = 0, if I repeatedly hit the cos button, I get the sequence: x = 0 x = 1 x = x = x = x = x = x = x = x = x = x = x = x = x = x = x = x = x =

Fixed-Point Iteration Looking at the first three digits of the last three iterations, we note that they appear to be converging:

Fixed-Point Iteration After applying cos 100 times using Matlab, I get the sequence: x = x = x = x = x = x = x = x = x = x = x =

Fixed-Point Iteration If, however, you set your calculator to degrees instead of radians, you would have found a different sequence: >> x = 0; >> for i = 1:6 x = cos(x/180*pi) end x = 1 x = x = x = x =

Fixed-Point Iteration In this case, the sequence converged significantly faster, but to what?

Fixed-Point Iteration Given an equation of the form x = f(x) if |f (1) (x)| < 1 in a neighbourhood of a solution to this equation, then for any initial point x 0 in this neighbourhood, the sequence x k + 1 = f(x k ) will converge to the solution to this equation

Fixed-Point Iteration The examples we have been looking at were finding points such that: x = cos(x) This will differ depending on whether you are using radians or degrees:

Fixed-Point Iteration We will now look at one of the longest known examples of fixed-point iteration Starting with any value and repeated apply the function f(x) = x/2 + 1/x For centuries, it has been known that this converges to

Fixed-Point Iteration To see why, recall that this converges to a solution of x = x/2 + 1/x which is also a solution of x 2 = x 2 /2 + 1 or x 2 /2 = 1 x 2 = 2

Newton’s Method We also get this sequence by applying Newton’s method which was covered in first year The function f(x) = x 2 – 2 has two roots, and we can find these roots using Newton’s method:

Newton’s Method Thus, we iterate Looking at the right hand side, it simplifies to:

Fixed-Point Iteration For example, consider the equation x = 2x(x – 1) This has two solutions, namely x = 0 and x = 0.5 If we start with x 0 = 0.1 and define f(x) = 2x(x – 1), we get the sequence

Fixed-Point Iteration Sequence is kxkxk |x k – x k – 1 | 00.1–

Fixed-Point Iteration To solve any such problem, we could continue to iterate until the sequence no longer changes, however, this does not always work Consider the slight modification, solving x = 2.4x(x – 1) which has the solution x = 7/12 ≈ ⋅⋅

Fixed-Point Iteration Starting with x 0 = 0.1, we converge much more slowly, and after 32 iterations: kxkxk |x k – x k – 1 | – – – – – – – – –11

Fixed-Point Iteration This sequence will never converge, and therefore we need a weaker halting condition We will continue iterating until: |x k – x k – 1 | <  step where  step is a suitably chosen predetermined criteria

Fixed-Point Iteration Unfortunately, this may also lead to erroneous results

Fixed-Point Iteration Suppose we are trying to solve x = sin(x) which has only one solution x = 0 After 1000 iterations, we still have: x 1000 = x 1001 = x 1002 = x 1003 =

Fixed-Point Iteration In this case, the rate of convergence is very, very slow The following table lists the number of iterations required to satisfy the terminating condition:

Fixed-Point Iteration The following table shows how many iterations are required  step Iterations xkxk 10 – – – – – – – –

Fixed-Point Iteration Notice that a small step size does not suggest that we are anywhere near the solution? After 20 million iterations: –the step size is less than 10 –12, but –the value ·· has only three zeros after the decimal place

Fixed-Point Iteration Therefore, we must restrict the number of iterations required to some fixed amount, say N Thus, if we iterate N times and have not satisfied our halting conditions, we stop and indicate that the method failed to converge

Fixed-Point Iteration If we stop due to iterating N times, this may mean that either: –a solution does not exist, –we chose a poor initial condition, or –we are using an inappropriate method for finding a solution

Fixed-Point Iteration Alternatively, to find a solution to x = sin(x), we could define f(x) = sin(x) – x and then iterate Thus, we get: x 0 = 0.1 x 1 = – x 2 =

Fixed-Point Iteration In this topic, we have seen a number of examples of fixed-point iteration –it may be possible to solve equations of the form x = f(x) by repeated applying f(x) –the form of the iteration will affect the convergence –it is necessary to define a halting condition stopping if the difference is less than  step –the sequence may not converge so we may have to halt after some fixed number of iterations

Usage Notes These slides are made publicly available on the web for anyone to use If you choose to use them, or a part thereof, for a course at another institution, I ask only three things: –that you inform me that you are using the slides, –that you acknowledge my work, and –that you alert me of any mistakes which I made or changes which you make, and allow me the option of incorporating such changes (with an acknowledgment) in my set of slides Sincerely, Douglas Wilhelm Harder, MMath