Professional Documents
Culture Documents
Chapter 5
Chapter 5
Root
• The Root of the function
𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0
• Can be determined by
−𝑏 ∓ 𝑏 2 − 4𝑎𝑐
𝑥=
2𝑎
Root
• Numerical method to determined the root or optima of the function
By plotting the function
(not very precise)
Bisection
False position
• Open methods
explicitly or implicit ?
𝑔𝑚 𝑔𝐶𝑑
𝑓 𝑚 = tanh 𝑡 −𝑣 𝑡
𝐶𝑑 𝑚
Bracketing methods
Need two initial guesses that bracket the root
Incremental Search
𝑓 𝑥
𝒇 𝒙𝟔 𝒇 𝒙𝟕
𝒇 𝒙𝟓 𝑓 𝑥𝑙 𝑓 𝑥𝑢 < 0
𝒇 𝒙𝟒
Searching for interval
𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 𝑥7
where the function
𝒇 𝒙𝟑 changes sign
𝑓 𝑥3 𝑓 𝑥4 < 0 Increment length (interval)
Short or long?
𝑥𝑙 = 𝑥3 , 𝑥𝑢 = 𝑥4
𝒇 𝒙𝟐 see Fig 5.4 (M-file)
𝒇 𝒙𝟏 And example 5.2
Bracketing methods - Bisection
1. If it is not given find (using incremental search) or guess two values that bracket the
root: 𝑥𝑙 𝑎𝑛𝑑 𝑥𝑢
( 𝑥𝑙 is the lower limit 𝑥𝑢 is the upper limit, 𝑓 𝑥𝑙 𝑓 𝑥𝑢 < 0 )
𝑥𝑙 +𝑥𝑢
2. Determine the midpoint 𝑥𝑟 , 𝑥𝑟 = test if 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠
2
4. If 𝑓 𝑥𝑙 𝑓 𝑥𝑟 < 0 then the new upper limit is 𝑥𝑟 ( 𝑥𝑙 stay the same, but 𝑥𝑢 now take the value of 𝑥𝑟 )
If 𝑓 𝑥𝑟 𝑓 𝑥𝑢 < 0 then the new lower limit is 𝑥𝑟 ( 𝑥𝑢 stay the same, but 𝑥𝑙 now take the value of 𝑥𝑟 )
4. 𝑓 𝑥𝑙 𝑓 𝑥𝑟 = 𝑓 50 𝑓 125 = −4.579 −0.409 > 0 But 𝑓 𝑥𝑟 𝑓 𝑥𝑢 = 𝑓 125 𝑓 200 = −0.409 (36.82) < 0
the new bracket values 𝑥𝑙 = 125 𝑎𝑛𝑑 𝑥𝑢 = 200
5. Repeat 2, 3 and 4 until until 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠
Bracketing methods - False position
1. If it is not given find (using incremental search) or guess two values that bracket the
root: 𝑥𝑙 𝑎𝑛𝑑 𝑥𝑢
( 𝑥𝑙 is the lower limit 𝑥𝑢 is the upper limit, 𝑓 𝑥𝑙 𝑓 𝑥𝑢 < 0 )
𝑓 𝑥𝑢 (𝑥𝑙 − 𝑥𝑢 )
2. Determine the 𝑥𝑟 , 𝑥𝑟 = 𝑥𝑢 − test if 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠
𝑓 𝑥𝑙 −𝑓 𝑥𝑢
4. If 𝑓 𝑥𝑙 𝑓 𝑥𝑟 < 0 then the new upper limit is 𝑥𝑟 ( 𝑥𝑙 stay the same, but 𝑥𝑢 now take the value of 𝑥𝑟 )
If 𝑓 𝑥𝑟 𝑓 𝑥𝑢 < 0 then the new lower limit is 𝑥𝑟 ( 𝑥𝑢 stay the same, but 𝑥𝑙 now take the value of 𝑥𝑟 )
𝑓 𝑥𝑢 (𝑥𝑙 − 𝑥𝑢 )
𝑥𝑟 = 𝑥𝑢 −
𝑓 𝑥𝑙 − 𝑓 𝑥𝑢