數值方法 2008, Applied Mathematics NDHU1  An iterative approach for root finding  Newton method Lecture 3II Root Finding.

Slides:



Advertisements
Similar presentations
M. Dumbser 1 / 23 Analisi Numerica Università degli Studi di Trento Dipartimento dIngegneria Civile ed Ambientale Dr.-Ing. Michael Dumbser Lecture on Numerical.
Advertisements

Numerical Solution of Nonlinear Equations
數值方法 2008, Applied Mathematics NDHU 1 Nonlinear systems Newton’s method The steepest descent method.
數值方法 2008, Applied Mathematics NDHU 1 Spline interpolation.
A few words about convergence We have been looking at e a as our measure of convergence A more technical means of differentiating the speed of convergence.
The Derivative. Definition Example (1) Find the derivative of f(x) = 4 at any point x.
Economics 214 Lecture 8 Introduction to Functions Cont.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Martin Mendez UASLP Chapter 61 Unit II.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
1 Chapter 4 Applications of Derivatives Extreme Values of Functions.
Secant Method Another Recursive Method. Secant Method The secant method is a recursive method used to find the solution to an equation like Newton’s Method.
數值方法 2008, Applied Mathematics NDHU 1 Simpson rule Composite Simpson rule.
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
Chapter 3 Application of Derivatives 3.1 Extreme Values of Functions Absolute maxima or minima are also referred to as global maxima or minima.
數值方法 2008, Applied Mathematics NDHU1  Looping for loop while loop  Break and return  Recursion Lecture 2 Iteration.
Objectives: 1.Be able to find the derivative using the Constant Rule. 2.Be able to find the derivative using the Power Rule. 3.Be able to find the derivative.
A technique for approximating the real zeros of a Function.
Lecture 3 Bisection method Download bisection02.m And ftest2.m From math.unm.edu/~plushnik/375.
Objectives: 1.Be able to find the derivative using the Constant Rule. 2.Be able to find the derivative using the Power Rule. 3.Be able to find the derivative.
Sec 15.6 Directional Derivatives and the Gradient Vector
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
CHAPTER Continuity The Product and Quotient Rules Though the derivative of the sum of two functions is the the sum of their derivatives, an analogous.
Graph and transform absolute-value functions.
Powerpoint Templates Page 1 Powerpoint Templates Review Calculus.
Example Ex. Find Sol. So. Example Ex. Find (1) (2) (3) Sol. (1) (2) (3)
Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (II)
L’Hopital’s Rule Limits of the form correspond to undetermined forms of limits since the result depends upon the expression in consideration. L’Hopital’s.
Calculus and Analytical Geometry Lecture # 8 MTH 104.
Logarithmic, Exponential, and Other Transcendental Functions
數值方法 2008 Applied Mathematics, NDHU1  Lagrange polynomial  Polynomial interpolation Lecture 4II.
數值方法 2008, Applied Mathematics NDHU1 Chaos time series.
DO NOW: Write each expression as a sum of powers of x:
Introduction to Optimization
4.8 Newton’s Method Mon Nov 9 Do Now Find the equation of a tangent line to f(x) = x^5 – x – 1 at x = 1.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Differentiation.
Yasser F. O. Mohammad Assiut University Egypt. Previously in NM Bracketing Methods Bisection False Position Fixed Point Iteration Local Convergence Methods.
Computers in Civil Engineering 53:081 Spring 2003 Lecture #8 Roots of Equations: Systems of Equations.
1. g(x) = -x g(x) = x 2 – 2 3. g(x)= 2 – 0.2x 4. g(x) = 2|x| – 2 5. g(x) = 2.2(x+ 2) 2 Algebra II 1.
Warm Up Write an equation of the tangent line to the curve at the given point. 1)f(x)= x 3 – x + 1 where x = -1 2)g(x) = 3sin(x/2) where x = π/2 3)h(x)
Searching a Linear Subspace Lecture VI. Deriving Subspaces There are several ways to derive the nullspace matrix (or kernel matrix). ◦ The methodology.
數值方法, Applied Mathematics NDHU 1 Linear system. 數值方法, Applied Mathematics NDHU 2 Linear system.
Numerical Methods and Optimization C o u r s e 1 By Bharat R Chaudhari.
Lecture 5 Polynomial Approximation
CS B553: Algorithms for Optimization and Learning
3.1 – Derivative of a Function
3.1 – Derivative of a Function
Techniques of Differentiation
Lecture 3 Taylor Series Expansion
A system of nonlinear equations
Absolute Value Functions
Some problems for your consideration
Use Part 1 of the Fundamental Theorem of Calculus to find the derivative of the function. {image}
Chain Rule AP Calculus.
Applications of Differential Calculus
Objective Graph and transform |Absolute-Value | functions.
Chapter 6.
3.11: Derivatives of Inverse Functions
Expressing functions as infinite series
L5 Optimal Design concepts pt A
Graphs of Related Functions.
Section 3.3 Piece Functions.
Differentiation Recap
3.8 Newton’s Method How do you find a root of the following function without a graphing calculator? This is what Newton did.
Absolute–Value Functions
Applications of Derivatives
Chapter 6.
1 Newton’s Method.
Presentation transcript:

數值方法 2008, Applied Mathematics NDHU1  An iterative approach for root finding  Newton method Lecture 3II Root Finding

數值方法 2008, Applied Mathematics NDHU2 Problem statement Find x such that f(x)=0 for a given f f denotes an arbitrary single-variable function Root finding

數值方法 2008, Applied Mathematics NDHU3 >> x=linspace(-1,3); >> plot(x,2.^x.^2-10*x+1)

數值方法 2008, Applied Mathematics NDHU4 Root finding Input: an expression Plot given function Find a root

數值方法 2008, Applied Mathematics NDHU5 Tangent line x xnxn y=f(x) y n =f(x n ) x n+1

Taylor series 數值方法 2008, Applied Mathematics NDHU6

7 An iterative approach Start at some guess Refine current guess by Find a tangent line that passes (x n,f(x n )) Set x n to a point at intersection of the tangent line to horizontal axis

數值方法 2008, Applied Mathematics NDHU8 Updating rule

數值方法 2008, Applied Mathematics NDHU9 Newton method An Iterative approach Random guess Refine current guess by an updating rule If a halting condition holds, go to step 2 otherwise exit

數值方法 2008, Applied Mathematics NDHU10 An iterative approach n=0 ; x n n=0 ; Set x n x n+1 Determine x n+1 Increase n by one Halting condition T F

數值方法 2008, Applied Mathematics NDHU11 An iterative approach x randomly Set x randomly an updating rule Apply an updating rule x to refine x ~( halting condition) exit

數值方法 2008, Applied Mathematics NDHU12 Halting condition Let x denote the current guess The absolute value of f(x) is expected as close as possible to zero Halting Condition abs(f(x)) < epslon epslon denotes a predefined small positive number

數值方法 2008, Applied Mathematics NDHU13 Initialization Random initialization A guess by the user

數值方法 2008, Applied Mathematics NDHU14 An iterative approach x = rand*2-1; s=sym(ss); ep=10^-6 f=inline(s); s1=diff(s); f1=inline(s1) x=x-f(x)/f1(x); fprintf('%f\n',x) ~( abs(f(x)) < ep) exit input an expression, ss

數值方法 2008, Applied Mathematics NDHU15 Demo_newton source codesource code demo_newton fstr=input('input a function:','s'); x_ini=input('guess its zero:'); x_zero=newton(fstr,x_ini); newton.m

數值方法 2008, Applied Mathematics NDHU16 Main Program

數值方法 2008, Applied Mathematics NDHU17 Newton method

數值方法 2008, Applied Mathematics NDHU18 >> demo_newton input a function:cos(x) guess its zero:2 iter=1 x= fx= iter=2 x= fx= iter=3 x= fx= >>

數值方法 2008, Applied Mathematics NDHU19 Example demo_newton input a function:2.^x.^2-10*x+1 guess its zero:1.5

數值方法 2008, Applied Mathematics NDHU20 Example >> demo_newton input a function:2.^x.^2-10*x+1 guess its zero:0.5

Second order expansion 數值方法 2008, Applied Mathematics NDHU21

Second order method Update rule 數值方法 2008, Applied Mathematics NDHU22

數值方法 2008, Applied Mathematics NDHU23 An iterative approach x = rand*2-1; s=sym(ss); ep=10^-6 f=inline(s); s1=diff(s); f1=inline(s1) s2=diff(s1); f2=inline(s2) a=f2(x)/2;b=-f2(x)+f1(x);c=f(x)-x*f1(x)+f2(x)*x^2/2;x=… fprintf('%f\n',x) ~( abs(f(x)) < ep) exit input an expression, ss

數值方法 2008, Applied Mathematics NDHU24 Unconstrained Optimization Problem statement Given a differentiable function, y=g(x), unconstrained optimization aims to find the minimum of g(x) Let x denote a minimum and

數值方法 2008, Applied Mathematics NDHU25 Optimization by Newton method Use symbolic differentiation to find the first derivative of a given function Apply the Newton method to find zeros of the first derivative

數值方法 2008, Applied Mathematics NDHU26 An iterative approach x = rand*2-1; s=sym(ss); ep=10^-6 g=inline(s); s1=diff(s); f=inline(s1); s2=diff(s1); f1=inline(s2) x=x-f(x)/f1(x); fprintf('%f gx=%f\n',x, g(x)) ~( abs(f(x)) < ep) exit input an expression, ss

數值方法 2008, Applied Mathematics NDHU27 First derivative ss=input('input a function:','s'); s=sym(ss); f=inline(s); s1=diff(s); f1=inline(s1); x=linspace(-5,5); plot(x,f(x));hold on; plot(x,f1(x));

數值方法 2008, Applied Mathematics NDHU28 >> x=linspace(-2*pi,2*pi); >> plot(x,(x-tanh(2*x+10)).^2)

數值方法 2008, Applied Mathematics NDHU29 >> demo_min input a function:(x-tanh(2*x+10)).^2 guess its minimum:4 Local minimum

數值方法 2008, Applied Mathematics NDHU30 >> demo_min input a function:(x-tanh(2*x+10)).^2 guess its minimum:-4 Local Minimum

數值方法 2008, Applied Mathematics NDHU31 Global minimum

數值方法 2008, Applied Mathematics NDHU32 >> demo_min input a function:0.2*x.^3-3*x+cos(x) guess its minimum:2

數值方法 2008, Applied Mathematics NDHU33 Exercise ex3II.pdf