Presentation on theme: "Open Methods Chapter 6 The Islamic University of Gaza"— Presentation transcript:
1 Open Methods Chapter 6 The Islamic University of Gaza Faculty of EngineeringCivil Engineering DepartmentNumerical AnalysisECIV 3306Chapter 6Open Methods
2 Open MethodsBracketing methods are based on assuming an interval of the function which brackets the root.The bracketing methods always converge to the root.Open methods are based on formulas that require only a single starting value of x or two starting values that do not necessarily bracket the root.These method sometimes diverge from the true root.
3 1. Simple Fixed-Point Iteration Rearrange the function so that x is on the left side of the equation:Bracketing methods are “convergent”.Fixed-point methods may sometime “diverge”, depending on the stating point (initial guess) and how the function behaves.
4 Simple Fixed-Point Iteration Examples:1.f(x) = x 2-2x+3 x = g(x)=(x2+3)/2f(x) = sin x x = g(x)= sin x + xf(x) = e-x- x x = g(x)= e-x
5 Simple Fixed-Point Iteration Convergence x = g(x) can be expressed as a pair of equations:y1= xy2= g(x)…. (component equations)Plot them separately.
6 Simple Fixed-Point Iteration Convergence Fixed-point iteration converges if :When the method converges, the error is roughly proportional to or less than the error of the previous step, therefore it is called “linearly convergent.”
8 Steps of Simple Fixed Pint Iteration 1. Rearrange the equation f(x) = 0 so that x is on the left hand side and g(x) is on the right hand side.e.g f(x) = x2-2x-1 = 0 x= (x2-1)/2g(x) = (x2-1)/22. Set xi at an initial guess xo.3. Evaluate g(xi)4. Let xi+1 = g(xi)5. Find a=(Xi+1 – xi)/Xi+1, and set xi at xi+16. Repeat steps 3 through 5 until |a|<= a
9 Example: Simple Fixed-Point Iteration f(x) = e-x - xf(x)f(x)=e-x - x1. f(x) is manipulated so that we get x=g(x) g(x) = e-x 2. Thus, the formula predicting the new value of x is: xi+1 = e-xi 3. Guess xo = 0 4. The iterations continues till the approx. error reaches a certain limiting valueRootxf(x)f1(x) = xg(x) = e-xx
10 Example: Simple Fixed-Point Iteration i xi g(xi) ea% et%
11 Example: Simple Fixed-Point Iteration i xi g(xi) ea% et%
13 Flow Chart – Fixed Point StartInput: xo , s, maxii=0a=1.1s1
14 1 False Stop True while a< s & i >maxi xn=0x0=xnPrint: xo, f(xo) ,a , iFalseTrue
15 2. The Newton-Raphson Method Most widely used method.Based on Taylor series expansion:Solve forNewton-Raphson formula
16 The Newton-Raphson Method A tangent to f(x) at the initial point xi is extended till it meets the x-axis at the improved estimate of the root xi+1.The iterations continues till the approx. error reaches a certain limiting value.f(x)Rootxxixi+1Slope f /(xi)f(xi)
17 Example: The Newton Raphson Method Use the Newton-Raphson method to find the root of e-x-x= 0 f(x) = e-x-x and f`(x)= -e-x-1; thusIter. xi et%<10-8
18 Flow Chart – Newton Raphson StartInput: xo , s, maxii=0a=1.1s1
19 1 False Stop True while a >s & i <maxi xn=0x0=xnPrint: xo, f(xo) ,a , iFalseTrue
20 Pitfalls of The Newton Raphson Method Cases where Newton Raphson method diverges or exhibit poor convergence. a) Reflection point b) oscillating around a local optimumc) Near zero slop , and d) zero slop
21 Thus, the formula predicting the xi+1 is: 3. The Secant MethodThe derivative is sometimes difficult to evaluate by the computer program. It may be replaced by a backward finite divided differenceThus, the formula predicting the xi+1 is:
22 The Secant MethodRequires two initial estimates of x , e.g, xo, x1. However, because f(x) is not required to change signs between estimates, it is not classified as a “bracketing” method.The scant method has the same properties as Newton’s method. Convergence is not guaranteed for all xo, x1, f(x).
23 Secant Method: Example Use the Secant method to find the root of e-x-x=0; f(x) = e-x-x and xi-1=0, x0=1 to get x1 of the first iteration using:Iter xi-1 f(xi-1) xi f(xi) xi et%
24 Comparison of convergence of False Position and Secant Methods Use two estimate xl and xuUse two estimate xi and xi-1f(x) must changes signs between xl and xuf(x) is not required to change signs between xi and xi-1Xr replaces whichever of the original values yielded a function value with the same sign as f(xr)Xi+1 replace xiXi replace xi-1Always convergeMay be divergeSlower convergence than Secant in case the secant converges.If converges, It does faster then False Position
25 Comparison of convergence of False Position and Secant Methods Use the false-position and secant method to find the root of f(x)=lnx. Start computation with xl= xi-1=0.5, xu=xi = 5.False position methodSecant methodIter xi xi xi+1Iter xl xu xr
26 False Position and Secant Methods Although the secant method may be divergent, when it converges it usually does so at a quicker rate than the false position methodSee the next figurexlxi-1xuxi
27 Comparison of the true percent relative Errors Et for the methods to the determine the root of f(x)=e-x-x
33 Multiple Roots“Multiple root” corresponds to a point where a function is tangent to the x axis.DifficultiesFunction does not change sign with double (or even number of multiple root), therefore, cannot use bracketing methods.Both f(x) and f′(x)=0, division by zero with Newton’s and Secant methods which may diverge around this root.
34 4. The Modified Newton Raphson Method Another u(x) is introduced such that u(x)=f(x)/f /(x);Getting the roots of u(x) using Newton Raphson technique:This function has roots at all the same locations as the original function
35 Modified Newton Raphson Method: Example Using the Newton Raphson and Modified Newton Raphson evaluate the multiple roots of f(x)= x3-5x2+7x-3 with an initial guess of x0=0Newton Raphson formula:Modified Newton Raphson formula:
36 Modified Newton Raphson Method: Example Newton Raphson Modified Newton-Raphson Iter xi et% iter xi et%Newton Raphson technique is linearly converging towards the true value of 1.0 while the Modified Newton Raphson is quadratically converging.For simple roots, modified Newton Raphson is less efficient and requires more computational effort than the standard Newton Raphson method
37 Systems of Nonlinear Equations Roots of a set of simultaneous equations:f1(x1,x2,…….,xn)=0f2 (x1,x2,…….,xn)=0fn (x1,x2,…….,xn)=0The solution is a set of x values that simultaneously get the equations to zero.
38 Systems of Nonlinear Equations Example: x2 + xy = 10 & y + 3xy2 = 57u(x,y) = x2+ xy -10 = 0v(x,y) = y+ 3xy2 -57 = 0The solution will be the value of x and y which makes u(x,y)=0 and v(x,y)=0These are x=2 and y=3Numerical methods used are extension of the open methods for solving single equation; Fixed point iteration and Newton-Raphson. (we will only discuss the Newton Raphson)
39 Systems of Nonlinear Equations: 2. Newton Raphson Method Recall the standard Newton Raphson formula:which can be written as the following formula
40 Systems of Nonlinear Equations: 2. Newton Raphson Method By multi-equation version (in this section we deal only with two equation) the formula can be derived in an identical fashion:u(x,y)=0 and v(x,y)=0
41 Systems of Nonlinear Equations: 2. Newton Raphson Method And thus
42 Systems of Nonlinear Equations: 2. Newton Raphson Method x 2+ xy =10 and y + 3xy 2 = 57are two nonlinear simultaneous equations with two unknown x and y they can be expressed in the form: use the point (1.5,3.5) as initial guess.