0% found this document useful (0 votes)
16 views14 pages

02 Roots of Equation

Uploaded by

smnyqstns
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views14 pages

02 Roots of Equation

Uploaded by

smnyqstns
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

02.

Roots of Equation

Computational Mathematics 1
Roots in Engineering
• Given
𝑔𝑚 𝑔𝑐𝑑
𝑣 𝑡 = tanh 𝑡
𝑐𝑑 𝑚
• Subtracting 𝑣 𝑡
𝑔𝑚 𝑔𝑐𝑑
𝑓 𝑚 = tanh 𝑡 − 𝑣(𝑡)
𝑐𝑑 𝑚
• “roots” problem, value of 𝑚 makes 𝑓 𝑚 = 0
Graphical method (example 2.1)
• In Matlab, determine the root of the equation for
the mass of the bungee jumper with a drag
coefficient of 0.25 kg/m to have a velocity of 36
m/s after 4s of free fall.

>> cd = 0.25; g = 9.81; v = 36; t = 4;


>> mass = linspace(0,200);
>> fmass = sqrt(g*mass/cd).*tanh(sqrt(g*cd./mass)*t)-v;
>> plot(mass,fmass),grid
Incremental Search
• 𝑓(𝑥) changed sign on opposite sides of the root
𝑓 𝑥𝑙 𝑓 𝑥𝑢 < 0
• locating an interval where the function changes
sign
• too small length, very time consuming
• too large length, very closely spaced roots might
be missed
Implementing Incremental Search
• 𝑓𝑢𝑛𝑐 within the range from 𝑥𝑚𝑖𝑛 to 𝑥𝑚𝑎𝑥
• 𝑛𝑠 number of intervals within the range
• 𝑓𝑜𝑟 loop step through each interval
• upper and lower bounds are stored in an
array 𝑥𝑏 (when sign change occurs)
M-file
(example 2.2)
• Use the M-file “𝑖𝑛𝑐𝑠𝑒𝑎𝑟𝑐ℎ” to identify
brackets within the interval [3, 6] for the
function:
𝑓 𝑥 = sin 10𝑥 + cos 3𝑥

>> incsearch(@(x) sin(10*x)+cos(3*x),3,6)


Bisection
• interval is always divided in half
• location of the root is determined within
the subinterval where the sign change
occurs
• subinterval then becomes the interval for
the next iteration
• process is repeated until the root
Using ex. 2.1
• function changes sign between values of 50 and 200
• Estimated root (𝑥𝑟 ) lies at midpoint
50 + 200
𝑥𝑟 = = 125
2
• Relative error (𝜖𝑡 )
142.74 − 125
𝜖𝑡 = × 100% = 12.24%
142.74
• While
𝑓 50 𝑓 125 = 1.87
∴ 𝑓 𝑥𝑙 𝑓 𝑥𝑢 < 0, root “must be” located between 125 and 200
• Process is repeated until acquiring accurate result
• Since the root is unknown, the actual error (𝜖𝑎 )
𝑥𝑟_𝑛𝑒𝑤 − 𝑥𝑟_𝑜𝑙𝑑
𝜖𝑎 = × 100%
𝑥𝑟_𝑛𝑒𝑤
• Once reached stopping criterion 𝜖𝑠 , the process is terminated
(example 2.3.a)
• Using Example 2.1, determine the roots until
𝜖𝑠 = 0.5% or below. Graph 𝜖𝑡 and 𝜖𝑎 vs iteration.
(example 2.3.b)
• Implement bisection using MATLAB.
False Position
• Interpolation method, locates the root by joining 𝑓(𝑥𝑙 ) and
𝑓(𝑥𝑢 ) with a straight line
• the intersection of the straight line
𝑓 𝑥𝑢 (𝑥𝑙 − 𝑥𝑢 )
𝑥𝑟 = 𝑥𝑢 −
𝑓 𝑥𝑙 − 𝑓(𝑥𝑢 )
• From Example 2.1
𝑥𝑙 = 50; 𝑓 𝑥𝑙 = −4.579
𝑥𝑢 = 200; 𝑓 𝑥𝑢 = 0.860
𝑥𝑟 = 176.277
𝜖𝑡 = 23.5%
• Next iteration 𝑓 𝑥𝑙 𝑓 𝑥𝑟 = −2.593
𝑥𝑙 = 50
𝑥𝑢 = 176.277
Example 4
• Use bisection and false position to locate
the root of
𝑓 𝑥 = 𝑥 10 − 1
• Homework: verify your answer using
MATLAB
Thank you for your attention

You might also like