數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.

Slides:



Advertisements
Similar presentations
Numerical Solution of Nonlinear Equations
Advertisements

Suggested problems from text (6 th edition) Chapter 3.1 p85 Problems 1, 4, 9, 10 Computer problems 1, 2, 4, 7 Chapter 3.2 p101 Problems 4, 15, 17, 19 Computer.
數值方法 2008, Applied Mathematics NDHU 1 Nonlinear systems Newton’s method The steepest descent method.
Derivatives - Equation of the Tangent Line Now that we can find the slope of the tangent line of a function at a given point, we need to find the equation.
CSE 541 – Numerical Methods
Open Methods Chapter 6 The Islamic University of Gaza
Optimisation The general problem: Want to minimise some function F(x) subject to constraints, a i (x) = 0, i=1,2,…,m 1 b i (x)  0, i=1,2,…,m 2 where x.
數值方法 2008, Applied Mathematics NDHU 1 Spline interpolation.
Open Methods Chapter 6 The Islamic University of Gaza
Second Term 05/061 Roots of Equations Bracketing Methods.
Roots of Equations Bracketing Methods.
4.2 The Mean Value Theorem.
Lectures on Numerical Methods 1 Numerical Methods Charudatt Kadolkar Copyright 2000 © Charudatt Kadolkar.
The Derivative. Objectives Students will be able to Use the “Newton’s Quotient and limits” process to calculate the derivative of a function. Determine.
Fin500J: Mathematical Foundations in Finance Topic 3: Numerical Methods for Solving Non-linear Equations Philip H. Dybvig Reference: Numerical Methods.
- + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
數值方法 2008, Applied Mathematics NDHU1  An iterative approach for root finding  Newton method Lecture 3II Root Finding.
Roots of Equations Chapter 3. Roots of Equations Also called “zeroes” of the equation –A value x such that f(x) = 0 Extremely important in applications.
Scientific Computing Algorithm Convergence and Root Finding Methods.
數值方法 2008, Applied Mathematics NDHU 1 Simpson rule Composite Simpson rule.
Solving Non-Linear Equations (Root Finding)
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
Scientific Computing Linear and Quadratic Splines.
數值方法 2008, Applied Mathematics NDHU1  Looping for loop while loop  Break and return  Recursion Lecture 2 Iteration.
Graphics Graphics Korea University kucg.korea.ac.kr 2. Solving Equations of One Variable Korea University Computer Graphics Lab. Lee Seung Ho / Shin.
Lecture 3 Bisection method Download bisection02.m And ftest2.m From math.unm.edu/~plushnik/375.
軟體實作與計算實驗 1  Binary search  While loop  Root Finding Lecture 6II While Loop.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
Newton’s Method, Root Finding with MATLAB and Excel
Solving Non-Linear Equations (Root Finding)
Numerical Methods Solution of Equation.
Introduction to Numerical Analysis I MATH/CMPSC 455 Bisection Method.
數值方法 2008 Applied Mathematics, NDHU1  Lagrange polynomial  Polynomial interpolation Lecture 4II.
Circle O and P are tangent to the x-axis at (4,0) and (13,0), respectively. Point A (4,8) is on circle O and point B (13,10) is on circle P. Line segment.
Finding zeros (also called roots) of a function Overview: Define the problem Methods of solution Graphical Newton’s Bisection Secant.
4 Numerical Methods Root Finding Secant Method Modified Secant
數值方法 2008, Applied Mathematics NDHU1 Chaos time series.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Differentiation.
A Different Solution  alternatively we can use the following algorithm: 1. if n == 0 done, otherwise I. print the string once II. print the string (n.
If f (x) is continuous over [ a, b ] and differentiable in (a,b), then at some point, c, between a and b : Mean Value Theorem for Derivatives.
數值方法, Applied Mathematics NDHU 1 Linear system. 數值方法, Applied Mathematics NDHU 2 Linear system.
Business Calculus Derivative Definition. 1.4 The Derivative The mathematical name of the formula is the derivative of f with respect to x. This is the.
Finding zeros (also called roots) of a function Overview: Define the problem Methods of solution Graphical Newton’s Bisection Secant.
Solution of Nonlinear Equations ( Root Finding Problems ) Definitions Classification of Methods  Analytical Solutions  Graphical Methods  Numerical.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
MATH342: Numerical Analysis Sunjae Kim.
Solution of Nonlinear Equations ( Root Finding Problems )
Chapter 5 Numerical Root Findings
4.2 The Mean Value Theorem.
3.2 Rolle’s Theorem and the
Lesson 63 Rolle’s Theorem and the Mean Value Theorem
4 Numerical Methods Root Finding Secant Method Modified Secant
Approximate computations
Solution of Nonlinear Equations (Root finding Problems
Lecture 3 Taylor Series Expansion
A system of nonlinear equations
Read Chapters 5 and 6 of the textbook
3.2 Rolle’s Theorem and the
Root finding.
Systems of Nonlinear Equations
Section 3.2 Differentiability.
3.8 Newton’s Method How do you find a root of the following function without a graphing calculator? This is what Newton did.
Finding zeros (also called roots) of a function
3.8: Newton’s Method Greg Kelly, Hanford High School, Richland, Washington.
3.8: Newton’s Method Greg Kelly, Hanford High School, Richland, Washington.
Rolle’s Theorem and the Mean Value Theorem
Rayat Shikshan Sanstha’s S.M.Joshi College, Hadapsar -28
Solutions for Nonlinear Equations
Presentation transcript:

數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4

數值方法 2008 Applied Mathematics, NDHU2 Drawbacks of Newton method x=linspace(-5,5);plot(x,x.^2-2*x-2); hold on;plot(x,-3,'r') Tangent line with zero slope

數值方法 2008 Applied Mathematics, NDHU3 Perturb current guess if zero derivative is detected

數值方法 2008 Applied Mathematics, NDHU4 Failure f=inline('x.^3-2*x+2'); x=linspace(-2,2);plot(x,f(x));hold on plot(x,0,'g') plot([0 1],[0 f(1)],'r'); plot([1 0],[0 f(0)],'r'); The tangent lines of x^3 - 2x + 2 at 0 and 1 intersect the x-axis at 1 and 0, respectively, illustrating why Newton's method oscillates between these values for some starting points.

數值方法 2008 Applied Mathematics, NDHU5 Bisection Method a b c=(a+b)/2 f(a) and f(c) at the same side: a  c f(b) and f(c) at the same side: b  c a b c a bc a  c b  c

數值方法 2008 Applied Mathematics, NDHU6 Bisection method 1. Create an inline function, f 2. Input two guesses, a < b 3. If f(a)f(b) > 0, return 4. Set c to the middle of a and b 5. If f(a)f(c) < 0, b = c 6. If f(b)f(c) < 0, a = c 7. If the halting condition holds, exit, otherwise goto step 4.

數值方法 2008 Applied Mathematics, NDHU7 Flow chart Input a,b,f with f(a)f(b) < 0 b=c abs(f(c)) < epslon T F f(a)f(c)<0 a=c c=0.5*(a+b) c=bisection(f,a,b) T

數值方法 2008 Applied Mathematics, NDHU8 Flow chart if f(a)f(b) > 0 return c=0.5*(a+b) b=c f(a)f(c)<0 a=c c=0.5*(a+b) abs(f(c)) < epslon c=bisection(f,a,b) T T return

數值方法 2008 Applied Mathematics, NDHU9 Halting condition abs(f(c)) < epslon Absolute f(c) is small enough to approach zero.

數值方法 2008 Applied Mathematics, NDHU10 Binary search Binary search is a general searching approach Let x represent a non-decreasing sequence x(i) <= x(j) if i < j Let y be an instance in sequence x Determine i * such that x(i * ) = y

數值方法 2008 Applied Mathematics, NDHU11 Flow chart Input x,y a=1;b=length(x) a=c Halting condition T F x(c)<y b=c c=ceil(0.5*(a+b))

數值方法 2008 Applied Mathematics, NDHU12 MATLAB: fzero x=linspace(-5,5);plot(x,sin(x.*x)); hold on; plot(x,0,'r') x = plot(x,0,'or')

數值方法 2008 Applied Mathematics, NDHU13 fzero x=linspace(-5,5);plot(x,sin(x.*x)); hold on; plot(x,0,'r') x = plot(x,0,'or')