You are on page 1of 10

Root and Optimization

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)

 By guessing the values


 Bracketing methods
• converge slowly
• always converge
• need two starting values that bracket the root
 Open methods
• converge fast
• not always converge
• Need one or two starting values but not necessarily to bracket the root
Root
• Bracketing methods

 Bisection
 False position

• Open methods

 Simple fixed-point iteration  linear convergence


 Newton-Raphson Method  quadratic convergence
 Secant Method
 Modified Secant Method
Bracketing methods

𝑔𝑚 𝑔𝐶𝑑 find 𝑚 that makes the velocity exceeds 36 m/s after 4 s ?


𝑣 𝑡 = tanh( 𝑡)
𝐶𝑑 𝑚

explicitly or implicit ?

Subtracting 𝑣 𝑡 from both side

𝑔𝑚 𝑔𝐶𝑑
𝑓 𝑚 = 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

3. Find the function value of 𝑓 𝑥𝑟

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 𝑥𝑟 )

5. Repeat 2, 3 and 4 until until 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠


Bracketing methods - Bisection
Example 5.3
Use the Bisection approach to determine the mass of the bungee jumper with a
drag coefficient of 0.25 kg/m to have a velocity of 36 m/s after 4 s of free fall.
𝑔𝑚 𝑔𝐶𝑑
𝑓 𝑚 = tanh 𝑡 −𝑣 𝑡
𝐶𝑑 𝑚

1. Guess two values 𝑥𝑙 = 50 𝑎𝑛𝑑 𝑥𝑢 = 200


50 + 200
2. 𝑥𝑟 = = 125 → test if 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠
2
3. 𝑓 𝑥𝑟 = 𝑓 125 = −0.409

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 𝜀𝑎 < 𝜀𝑠
𝑓 𝑥𝑙 −𝑓 𝑥𝑢

3. Find the function value of 𝑓 𝑥𝑟

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 𝑥𝑟 )

5. Repeat 2, 3 and 4 until 𝜀𝑡 or 𝜀𝑎 < 𝜀𝑠


Bracketing methods - False position

𝑓 𝑥𝑢 (𝑥𝑙 − 𝑥𝑢 )
𝑥𝑟 = 𝑥𝑢 −
𝑓 𝑥𝑙 − 𝑓 𝑥𝑢

Steven C. Chapra, Applied Numerical Methods with MATLAB


for Engineers and Scientists, 3rd ed, McGraw, New York, 2012.

You might also like