Professional Documents
Culture Documents
Bisection 2nd Prob PDF
Bisection 2nd Prob PDF
Root-Finding Problem
• Given computable f (x) ∈ C[a, b], problem is to find
for x ∈ [a, b] a solution to
f (x) = 0.
• Solution r with f (r) = 0 is root or zero of f .
• Maybe more than one solution; rearrangement some-
times needed: x2 = sin(x) + 0.5.
Bisection Algorithm
• Input: computable f (x) and [a, b], accuracy level .
• Initialization:
find [a1, b1] ⊂ [a, b], with f (a1)f (b1) < 0, set i = 1.
• Basic Bisection Algorithm:
1. Set ri = (ai + bi)/2;
2. If f (ai)f (ri) < 0, set bi+1 = ri, ai+1 = ai;
otherwise, set ai+1 = ri, bi+1 = bi;
3. If (bi+1 − ai+1)/2 > , set i = i + 1 and go to step 1
4. Stop with r ≈ (bi+1 + ai+1)/2.
Notes:
careful algorithm checks for f (ri) = 0, limits i;
other stopping conditions possible, e.g. |f (ri)| < .
2
x −sin(x)−.5
2.5
1.5
0.5
−0.5
2
BISECTION METHOD CONTINUED
Example : f (x) = x2 − sin(x) − 0.5, for [a, b] = [0, 2],
= 10−3; note f (0)f (2) < 0.
i a r b (b-a)/2
1 0 1 2 1
2 1 1.5 2 0.5
3 1 1.25 1.5 0.25
4 1 1.125 1.25 0.125
5 1.125 1.1875 1.25 0.0625
6 1.1875 1.2188 1.25 0.03125
7 1.1875 1.2031 1.2188 0.015625
8 1.1875 1.1953 1.2031 0.0078125
9 1.1953 1.1992 1.2031 0.0039062
10 1.1953 1.1973 1.1992 0.0019531
11 1.1953 1.1963 1.1973 0.00097656
f (1.1963) = −0.0015836;
[a, b] = [−1, 0]?
1 -1 -0.5 0 0.5
2 -0.5 -0.25 0 0.25
3 -0.5 -0.375 -0.25 0.125
4 -0.375 -0.3125 -0.25 0.0625
5 -0.375 -0.34375 -0.3125 0.03125
6 -0.375 -0.35938 -0.34375 0.015625
7 -0.375 -0.36719 -0.35938 0.0078125
8 -0.375 -0.37109 -0.36719 0.0039062
9 -0.37109 -0.36914 -0.36719 0.0019531
10 -0.37109 -0.37012 -0.36914 0.00097656
f (−.37012) = −0.0012839.
3
BISECTION METHOD CONTINUED
4
FIXED POINT-ITERATION METHODS
Background
• Terminology: given g ∈ C[a, b] a fixed point r for
g(x) is a point where r = g(r).
• Relation to rootfinding:
given g(x), a fixed point for g(x) is root of
f (x) = x − g(x);
given f (x), a root of f (x) is a fixed point for
g(x) = x − f (x).
• Fixed points from graphs: a fixed point exists if the
graph y = x crosses the graph y = g(x).
Example: g(x) = cos(x):
y = x and y = cos(x)
3
−1
−2
−3
−3 −2 −1 0 1 2 3
5
FIXED-POINT METHODS CONTINUED
6
2
y=x and y=2/x+5/x
7
1
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
2.8
2.6
2.4
2.2
1.8
1.6
1.4
1.2
1
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
7
FIXED-POINT METHODS CONTINUED
• Another example: x2 −sin(x) = 0.5, with root in [0, 2].
Some possible rearrangments:
a) x = (sin(x)
r
+ .5)/x has [g(0), g(2)] → [.7, ∞);
b) x = sin(x) + .5 has [g(0), g(2)] ⊂ [.70, 1.19].
Fixed-Point Iterations:
i a) b)
0 2 2
1 0.70465 1.1871
2 1.6288 1.1947
3 0.91986 1.1959
4 1.4084 1.1960495
5 1.0557 1.19607706
6 1.2979 1.196081273
7 1.1272 1.1960819169
Another solution in [−1, 0]?
[ga(−.5), ga(0)] ⊂ [−.05, ∞), [gb(−.5), gb(0)] ⊂ [0, .71].
c) x = sin−1(x2 − .5), has [g(−.5), g(0)] ⊂ [−.53, .53].
Fixed-Point Iterations:
i a) b) c)
0 -0.5 -0.5 -0.5
1 -0.04115 0.14344 -0.25268
2 -11.151 0.80184 -0.45132
3 -0.13343 1.1039 -0.30083
4 -2.7503 1.1802 -0.42191
5 -0.04312 1.1936 -0.32783
6 -10.596 1.1957 -0.40338
7 -0.13413 1.1960 -0.34404
8
FP METHODS ANALYSIS
9
FP METHODS ANALYSIS CONTINUED
Fixed Point Theorem: if g ∈ C[a, b], g(x) ∈ [a, b] and
|g 0(x)| ≤ k < 1 for x ∈ (a, b), then for any r0 ∈ [a, b],
rn = g(rn−1) converges to a unique fixed point r ∈ [a, b].
Proof: consider |rn − r| = |g(rn−1) − g(r)|
Notes:
a) Linear convergence: if ei is the error at each step i, and
ei+1
lim | | = S < 1,
i→∞ ei
10