Bisection algorithm

-
Assumption
-
Function
-
g(x):D⊂R→R
-
-
-
하고자 하는 것
-
find a root or solution x∗ of the equation
-
g(x)=0,x∈[a,b]
-
where g is continuous and g(a)g(b) < 0
-
-
-
x∗를 찾기 위한 조건
-
∃n>0,s.t.|xn−x∗|<ϵ,
-
where x∗ is the solution of g(x)=0
- 위 조건을 만족하는 xn 찾아 ˆx (approximated solution)으로 채택
-
(Intermediate value theorem) Suppose g:[a,b]→R is continuous, g(a) and g(b) are of opposite sign. Then there exists a point x∈(a,b) such that g(x)=0
Bisection 알고리즘은 위 Intermediate value theorem의 아이디어를 차용한다.
Bisection algorithm
Bisection 알고리즘의 작동방식을 간단하게 나타내면 다음과 같다.
- 부호가 다른 함수값을 갖는 두 점 a, b를 초깃값 (a1,b1)으로 설정한다.
- a1,b1의 중간 점인 ([a1,b1]를 이분하는) x1을 구한다.
- x1에서의 함수값이 갖는 부호 (sign(g(x1))를 계산한다.
- a1,b1 중 함수값의 부호가 x1과 같은 점을 업데이트한다.
예) g(a1)과g(x1)의 부호가 같은 경우, (sign(g(a1))=sign(g(x1)))
a2=x1 그리고 b2=b1 으로 업데이트
- 새롭게 얻은 범위 [a2,b2]에 대해 Bisection algorithm 반복적용
- |xn+1−xn|<ϵ 조건 만족할 때 멈춤 (x의 변화가 미리 설정한 error bound 보다 작아지면 멈춤)
- 이 때의 xn을 ˆx로 채택
아래는 구체적 알고리즘
-
First step
(1): set a1=a and b1=b
and let x1=(a1+b1)/2
(2): If g(x1)=0 then stop, concluding that x∗=x1
(3): If g(x1)≠0 then g(x1) must have the same sign as either g(a1) or g(b1)
(3-1): If g(x1)g(a1)>0 then set a2=x1 and b2=b1
(3-2): If g(x1)g(b1)>0 then set a2=a1 and b2=x1
(4): Start over with the interval [a2,b2] instead of [a2,b2]
-
Full steps
(1): Set a1=a,b1,=b and x1=(a+b)/2
(2): For n=1,2,⋯, to the followings
(2-1): If g(xn)g(an)>0 then set an+1=xn and bn+1=bn
(2-2): If g(xn)g(an)<0 then set an+1=an and bn+1=xn
(2-3): Set $x_{n+1} = (a_{n+1}+b_{n+1})/2
(2-4): If |xn+1−xn|<ϵ then stop
(3): Set ˆx=xn
'Data Science: 이론 > etc' 카테고리의 다른 글
[Optimization] Optimization of Univariate Functions 일변량 함수 최적화 정리 / 설명 (0) | 2020.07.21 |
---|---|
[cs231n] Lecture 11 | Detection and Segmentation (0) | 2019.05.15 |