Numerical Analysis - Root Finding I- Hanyang University Jong-Il Park Root Finding F(t) t F(t)=0 Analytic하게 근을 구할 수 없을 때 수치해법 필요 eg. F(t) = e-t(3cos2t + 4sin2t) Department of Computer Science and Engineering, Hanyang University General procedure of root finding Step 1. 해의 근방을 찾는 과정 graphical method incremental search experience solution of a simplified model Step 2. 정확한 해를 찾는 과정 Bracketing method Open method Graphical method Department of Computer Science and Engineering, Hanyang University Bracketing method 구간 [a,b]의 양끝점 사이에 근이 존재한다고 가정하고, 구간의 폭을 체계적으로 좁혀감 정확한 근으로의 수렴성이 좋음 종류 bisection method linear interpolation method Department of Computer Science and Engineering, Hanyang University Open method 임의의 시작점에서 시작 규칙적 반복계산으로 근을 구함 초기값에 따라 발산가능성 있음 bracketing method보다 수렴속도 빠름 종류 fixed-point iteration Newton-Raphson method Secant method Muller method Department of Computer Science and Engineering, Hanyang University 대략적 구간 찾기 Graphical method Department of Computer Science and Engineering, Hanyang University 대략적 구간 찾기 Incremental search method 초기값 x와 dx 사이의 함수값의 부호 조사 변화가 생기면 그 구간 안에 해가 존재 난점: dx의 크기 • 작으면 긴 계산시간, 크면 해를 놓침 중근일 경우 • 해를 놓칠 가능성 큼 양끝점의 도함수를 계산 if 서로 다른 부호 => 극소점 존재 정확한 해를 찾기 위해 반드시 프로그램의 앞부분에 있어야 함 Department of Computer Science and Engineering, Hanyang University Bisection method(I) =Half Interval method = Bolzano method Department of Computer Science and Engineering, Hanyang University Bisection method(II) - 한번 반복할 때마다 구간이 1/2로 감소 - 간단하고, 오차범위의 확인이 용이 n 번 반복시, 최대오차 < (초기구간간격/2n) - 수렴속도가 느린 편임 - 다중근의 경우에 부호변화가 없으므로 적절치 못함 Department of Computer Science and Engineering, Hanyang University Linear interpolation method(I) = False position method Principle Algorithm Department of Computer Science and Engineering, Hanyang University Linear interpolation method(II) Algorithm Department of Computer Science and Engineering, Hanyang University Convergence speed Bisection보다 대체로 빠른 수렴성 수렴 속도가 곡률에 의존(경우에 따라 매우 느린 수렴) Modified linear interpolation method 제안됨 Department of Computer Science and Engineering, Hanyang University Modified linear interpolation 0.5f(x2 ) x2 Slow convergence x2 Faster convergence Modified Linear Interpolation Department of Computer Science and Engineering, Hanyang University Open methods Department of Computer Science and Engineering, Hanyang University Newton-Raphson method(I) 원리 Department of Computer Science and Engineering, Hanyang University Newton-Raphson method(II) Fast convergence – quadratic convergence 도함수 계산이 복잡할 때는 비효율적 Initial guess가 중요함 Troubles Cycling Wandering Overshooting Department of Computer Science and Engineering, Hanyang University Secant method(I) Department of Computer Science and Engineering, Hanyang University Secant method(II) Linear interpolation과 비슷한 복잡성 update rule만 다름 Linear interpolation 보다 빠른 수렴성 Newton-Raphson method 보다 우수한 안정성 Department of Computer Science and Engineering, Hanyang University Comparison: Convergence speed Department of Computer Science and Engineering, Hanyang University Fixed point iteration(I) 원리 f(x)=0 x=g(x) Iteration rule xk+1=g(xk) Convergent if contraction mapping Department of Computer Science and Engineering, Hanyang University Fixed point iteration(II) Department of Computer Science and Engineering, Hanyang University Muller method(I) Generalization of the Secant method Fast convergence Secant Muller Department of Computer Science and Engineering, Hanyang University Muller method(II) Algorithm Department of Computer Science and Engineering, Hanyang University Error analysis Linear convergence Quadratic convergence Department of Computer Science and Engineering, Hanyang University Accelerating convergence Aitken’s D2 method Rapid convergence! Department of Computer Science and Engineering, Hanyang University Fail-safe methods Combination of Newton and Bisection if(out of bound || small reduction of bracket) update by Bisection method rtsafe.c in NR in C Ridder's method (good performance) zriddr.c in NR in C Department of Computer Science and Engineering, Hanyang University Homework #3 (I) [Due: 9/26] Programming: Find the roots of the Bessel function Jo in the interval [1.0, 10.0] using the following methods: a) Bisection (rtbis.c) b) Linear interpolation (rtflsp.c) c) Secant (rtsec.c) d) Newton-Raphson (rtnewt.c) e) Newton with bracketing (rtsafe.c) Hint First, use bracketing routine (zbrak.c). Then, call proper routines in NR in C. -6 x Set xacc=10 Use “pointer to function” to write succinct source codes (Cont’) Department of Computer Science and Engineering, Hanyang University Homework #3 (II) Write source codes for Muller method (muller.c) and do the same job as above. Discuss the convergence speed of the methods. Solve the following problems using the routine of rtsafe.c in NR in C 10 e-x sin(2p x)-2= 0, on [0.1,1] x2 - 2xe-x + e-2x = 0, on [0,1] cos(x+sqrt(2))+x(x/2+sqrt(2)) = 0, on [-2,-1] Department of Computer Science and Engineering, Hanyang University