Professional Documents
Culture Documents
Algebraic equation: ax 2 bx c 0
Transcendental equation: 1 cos x 5x 0
xnew xold
a 100%
xnew
Location of the root lies within the interval where the sign
change occurs
The absolute error is reduced by a factor of 2 for each iteration.
[root,fx,ea,iter]=bisect('func',0.6,0.8)
Try yourself:
Modify the bisect.m
function file to incorporate the
regula falsi method
f ( xi ) 0
f ( xi )
xi xi 1
f ( xi )
xi 1 xi
f ( xi )
x i1 x i
a 100%
x i1
x i1 x i
f(xi-1)
f (x i )x i1 x i
x i1 x i
f (x i1) f (x i )
xi-1 xi x
Note: Requires two initial guesses
for x
Exercise:
Can you modify newtraph.m function file and make it
applicable for the secant method?
CE 206: Engg. Computation Sessional Dr. Tanvir Ahmed
Secant Method: Exercise
Apply the developed code for the secant method to find the
first positive root of f(x) = sinx + cos(1+x2) – 1
where x is in radians.
Use four iterations with initial guesses of
(i) 1.0 and 3.0
(ii) 1.5 and 2.5, and
(iii) 1.5 and 2.25
Example:
Find the roots of
f(x)=x5 - 3.5x4 + 2.75x3 + 2.125x2 - 3.875x + 1.25
x = roots([1 -3.5 2.75 2.125 -3.875 1.25])
15 kips
5 ft 2 ft 1 ft 2 ft
M ( x) 10 x 0 10 x 5 15 x 8 150 x 7 57 x
2 2 1 0
5 5 15 57 3
u ( x) x 0 x 5 x 8 75 x 7 x 238.25 x
4 4 2 2
6 6 6 6
Using any root location technique, find the points where shear and
bending moment equal to zero and where the displacement is maximum.
Also draw the shear force, bending moment and displacement diagrams
15 kips
5 ft 2 ft 1 ft 2 ft
V ( x) 20 x 0 20 x 5 15 x 8 57
1 1 0
function f = V(x)
f=20*(sing(x,0,1)-sing(x,5,1))-15*sing(x,8,0)-57;
Fill up the following table (use bisection method): express your results for
an absolute error of 0.05 °C
x 0
n log 2 log 2 40 9.6439
E 0.05
a,d
Absolute error 10 iterations should be
enough
Use bisect.m to compute the roots for maximum 10 iterations and also
find the real roots using fzero function. Compare results.
Less
Osat Approximation Exact Error than
8 26.75781 26.78017 0.0224 0.05
10 15.35156 15.38821 0.0366
12 7.46094 7.46519 0.0043
Some examples:
- Water level in a spherical tank cannot exceed the diameter
- Temperature in natural water bodies usually within a specific
range, (e.g. cannot be negative)
- deflection of a beam is maximum where the du/dx is zero
- Water level in a tank cannot exceed tank depth (or cannot be
negative)
- etc.
Solve for the critical depth (y) using both bisection and method of false
position using the initial guesses 0.5 and 2.5 and iterate until the
approximate error falls below 1% or the number of iterations exceed 10.
Compare your results from both methods