chap06classlecture

# chap06classlecture - Chapter 6 Chapter 6 Roots: Open...

This preview shows pages 1–16. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 6 Chapter 6 Roots: Open Methods Roots: Open Methods Open Methods Open Methods 6.1 Simple Fixed-Point Iteration 6.2 Newton-Raphson Method 6.3 Secant Methods 6.4 MATLAB function: fzero 6.5 Polynomials Open Methods Open Methods What if we don ' t have two endpoints bracketing the root? There exist open methods which do not require bracketed intervals Newton-Raphson method, Secant Method, Mullers method, fixed-point iterations First one to consider is the fixed-point method Bracketing and Open Methods Bracketing and Open Methods x x sin x x sin 2 3 x x 3 x 2 x 2 2 + = = + = = +- Fixed-Point Iteration Fixed-Point Iteration First open method is fixed point iteration Idea: rewrite original equation f(x) = 0 into another form x = g(x). Use iteration x i+1 = g ( x i ) to find a value that reaches convergence Example: Simple Simple Fixed-Point Fixed-Point Iteration Iteration Two Alternative Graphical Methods f(x) = f 1 (x) f 2 (x) = 0 f ( x ) = 0 f 1 ( x ) = f 2 ( x ) Fixed-Point Fixed-Point Iteration Iteration Convergent Divergent For our Mannings equation problem ( 29 ( 29 S 2h b bh n 1 Q 1/2 2/3 5/3 = +- can be arranged as (non-unique) ( 29 h 2 b S nQ b 1 h 2/5 3/5 1/2 + = MATLAB Example MATLAB Example Script file for fix-point iteration: fix_point.m p=[1 0 -3 1]; format long; r=roots(p) r =-1.87938524157182 1.53208888623796 0.34729635533386 function y = my_func(x) % Solve f(x) = x^3 - 3x + 1 = 0 % Rearrange x = g(x) = (3x-1)^(1/3) % MATLAB may give complex roots when x < 1/3 % Use "sign" to obtain negative root y = abs(3*x-1).^(1/3).*sign(3*x-1); fix_point('my_func'); enter initial guess: xguess = 0.35 allowable tolerance: es = 0.0001 maximum number of iterations: maxit = 100 Fixed-position method has converged step x 1.0000 0.3500 2.0000 0.3684 3.0000 0.4721 4.0000 0.7467 5.0000 1.0743 6.0000 1.3051 7.0000 1.4285 8.0000 1.4866 9.0000 1.5125 10.0000 1.5237 11.0000 1.5285 12.0000 1.5306 13.0000 1.5314 14.0000 1.5318 15.0000 1.5320 16.0000 1.5320 fix_point('my_func'); enter initial guess: xguess = 0.34 allowable tolerance: es = 0.0001 maximum number of iterations: maxit = 100 Fixed-position method has converged step x 1.0000 0.3400 2.0000 0.2714 3.0000 -0.5705 4.0000 -1.3944 5.0000 -1.7306 6.0000 -1.8363 7.0000 -1.8671 8.0000 -1.8759 9.0000 -1.8784 10.0000 -1.8791 11.0000 -1.8793 12.0000 -1.8794 x guess = 0.34 x r = - 1.8794 x guess = 0.35 x r = 1.5320 Need to rearrange equation in order to find r 2 r 1 r 3 r 2 Fixed-point iteration doesnt always work Basically, if |g(x)| < 1 near the intersection with the x line, it will work 1)/3 (x (x) g x 1) (3x (x) g x 1 3x x f(x) 3 2 1/3 1 3 + = =- = = = +- = Convergence Criterion Convergence Criterion Give two roots only Third root >> x=-2:0.02:2; y=my_func1(x); z=x*0; >> H=plot(x,y,'r',x,x,'b'); hold on; plot(x,z,'k'); >> set(H,'LineWidth',2.0); >> axis([-2 2 -2 2]); xlabel('x'); ylabel('g(x) = (x^3 + 1)/3'); >> Title('Fixed-Point Iteration : f(x) = x^3 - 3x + 1 = 0'); 1 ) x ( ' g < 1 ) x ( ' g 1 ) x ( ' g x = g(x) 1 ) x ( ' g divergent ( 29 ( 29 ( 29 ( 29...
View Full Document

## This note was uploaded on 03/07/2009 for the course CVEN 302 taught by Professor Edge during the Spring '08 term at Texas A&M.

### Page1 / 62

chap06classlecture - Chapter 6 Chapter 6 Roots: Open...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online