Intuition Concept

์ปดํ“จํ„ฐ๊ฐ€ ์ƒ๊ฐํ•˜๋Š” ๋ฐฉ์‹์€ ์ ˆ๋ ˆ์ ˆ๋ ˆ์™€ ๋…ธ๊ฐ€๋‹ค ๋ฐ–์— ์—†์–ด์š”.
๋ฌด์Šจ๋ง์ด๋ƒ๋ฉด Yes, No์˜ ์„ ํƒ๋ฐฉ์‹๊ณผ, ๊ณ„์‚ฐ์„ ๊ณ„์†ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์ „๋ถ€๋ผ๋Š” ์˜๋ฏธ์ฃ .
๋ฉ์ฒญํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ๊ฒ ์ง€๋งŒ ์ด๊ฒƒ์„ ์ž˜ ํ™œ์šฉํ•˜๋ฉด ๊ฐ•์ ์ด ๋ฉ๋‹ˆ๋‹ค.

๋‹คํ•ญ์‹์˜ ๊ทผ์„ ๊ตฌํ•˜๋Š” ๋ฐฉ๋ฒ•์€ roots๋ผ๋Š” ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋๋‚ฌ์—ˆ์ฃ .ย 

ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค๋ฃจ๋Š” ํ•จ์ˆ˜๋Š” ๊ฑฐ๊ธฐ์„œ ๊ทธ์น˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค๋ฅธ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ˆ˜ํ•™์ ์œผ๋กœ ๊ทผ์ด๋ผ๋Š” ๊ฒƒ์€ 1๊ฐœ์˜ ๋ณ€์ˆ˜๋งŒ ์žˆ๋Š” ํ•จ์ˆ˜ ์ผ๋•Œ x์ถ•๊ณผ ๋งŒ๋‚˜๋Š” ์ ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.ย 

์œ„์˜ ๊ทธ๋ฆผ ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” 3์ถ•์„ ํ†ต๊ณผํ•˜๋Š” ์ ์ด 3๊ฐœ๋„ค์š”.ย  ์ด๋Ÿฐ ๊ฒฝ์šฐ ์ปดํ“จํ„ฐ๋Š” ๊ทผ์„ ์ฐพ์„ ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์ด ๊ฒฝ์šฐ๋Š” ์–ด๋–จ๊นŒ์š”?

์ ‘ํ•˜๋Š” ๊ฒฝ์šฐ๋„ ๋ถ„๋ช… ๊ทผ์ด ๋งž์ง€๋งŒ ์ปดํ“จํ„ฐ๋Š” ์ด ์ ‘ํ•˜๋Š” ์ ์„ ๊ทผ์œผ๋กœ ํŒ๋‹จํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค.ย 

์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ž์ฒด๊ฐ€ ํ•จ์ˆ˜๊ฐ’์˜ ๋ถ€ํ˜ธ๊ฐ€ ๋ฐ”๋€Œ์—ˆ์„ ๋•Œ, ๋ฉˆ์ถ”๋„๋ก ์งœ์—ฌ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด์ฃ .ย 

๋”ฐ๋ผ์„œ ์ง€๊ธˆ ๋ฐฐ์šธ ์ด ํ•จ์ˆ˜๋Š” ์ ‘ํ•˜๋Š” ๊ฒฝ์šฐ์— ์‚ฌ์šฉํ•˜๊ธฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

ํ•จ์ˆ˜์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์ค‘๊ฐ„๊ฐ’์˜ ์ •๋ฆฌ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ’์„ ์ •ํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.ย 

์ •ํ•ด์ง„ ๊ฐ’์œผ๋กœ ๋ถ€ํ„ฐ ๊ฐ€๊นŒ์šด ๊ทผ์— ๊ฐ€๊นŒ์šด ์ชฝ์— ์žˆ๋Š” ๊ฐ’์œผ๋กœ ๋‹ค๊ฐ€๊ฐ€๋ฉฐ ์ตœ์ข…์ ์ธ ๊ทผ์„ ๊ฒฐ๊ณผ๋ฌผ๋กœ ๋‚ด๋†“์Šต๋‹ˆ๋‹ค.

Function

๊ทผ = fzero(ํ•จ์ˆ˜,์ดˆ๊ธฐ๊ฐ’)

์—ฌ๊ธฐ์„œ ํ•จ์ˆ˜๋Š”, f(x) = 0 ์˜ ํ˜•ํƒœ๋กœ ๋งŒ๋“  ๋’ค์— ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Example

(x+1)*exp(-x) = 0.3์˜ ๊ทผ์„ ๊ตฌํ•ด๋ผ.

f(x) = (x+1)*exp(-x)-0.3

์ดˆ๊ธฐ๊ฐ’์„ ์ •ํ•ด์•ผ ํ•˜๋‹ˆ ํ•จ์ˆ˜๋ฅผ ๊ทธ๋ ค๋ด…๋‹ˆ๋‹ค.

f = @(x)(x+1)*exp(-x)-0.3 fplot(f,[-1 8])

2๊ฐœ์˜ ๊ทผ์ด ๋‚˜์˜ฌ ๊ฒƒ์œผ๋กœ ๋ณด์ด๊ณ  ๊ทผ์ฒ˜๊ฐ’์„ ์‚ฐ์ •ํ•ด์„œ ๋„ฃ์Šต๋‹ˆ๋‹ค.

f = @(x)(x+1)*exp(-x)-0.3
fplot(f,[-1 8]) 
a=fzero(f, -0.2 )
[b f_value]=fzero(f, 3, optimset('display', 'iter'))
a =  -0.8749   ๋ถ€ํ˜ธ ๋ณ€๊ฒฝ์ด ํฌํ•จ๋œ 3์˜ ๊ตฌ๊ฐ„์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค. 
 
๋ถ€ํ˜ธ ๋ณ€๊ฒฝ์ด ํฌํ•จ๋œ 3์˜ ๊ตฌ๊ฐ„์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
 Func-count    a          f(a)             b          f(b)        Procedure
    1               3     -0.100852             3     -0.100852   initial interval
    3         2.91515    -0.0878145       3.08485     -0.113172   search
    5            2.88    -0.0821971          3.12     -0.118072   search
    7         2.83029    -0.0740299       3.16971     -0.124806   search
    9            2.76     -0.062023          3.24     -0.133945   search
   11         2.66059     -0.044099       3.33941     -0.146134   search
   13            2.52    -0.0167822          3.48     -0.161983   search
   14         2.32118     0.0259999          3.48     -0.161983   search
 
๊ตฌ๊ฐ„ [2.32118, 3.48]์—์„œ ์˜์ ์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
 Func-count    x          f(x)             Procedure
   14         2.32118     0.0259999        initial
   15         2.48145   -0.00887552        interpolation
   16         2.44067  -0.000308135        interpolation
   17         2.43922   2.17727e-07        interpolation
   18         2.43922  -9.30881e-11        interpolation
   19         2.43922             0        interpolation
 
๊ตฌ๊ฐ„ [2.32118, 3.48]์—์„œ ์˜์ ์ด ๋ฐœ๊ฒฌ๋จ
 
b =
 
    2.4392
 
 
f_value =
 
     0

์˜ต์…˜ optimset(โ€˜displayโ€™, โ€˜iterโ€™)์„ ์„ ํƒํ•˜๋ฉด ์ง„ํ–‰๋˜๋Š” ๊ณผ์ •์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

Reference