Graphics Programs Reference
In-Depth Information
dx = (b - a)/2.0;
x=a+dx;
end
% Check for convergence
if abs(dx) < tol*max(b,1.0)
root = x; return
end
end
root = NaN
EXAMPLE 4.6
Aroot of f ( x )
x 3
10 x 2
=
+
5
=
0lies close to x
=
0
.
7
.
Compute this root with the
Newton-Raphsonmethod.
Solution The derivative of the functionis f ( x )
3 x 2
=
20 x
,
so that the Newton-
Raphson formulainEq. (4.3) is
x 3
10 x 2
2 x 3
10 x 2
f ( x )
f ( x ) =
+
5
5
=
x
x
x
20 )
It takes only two iterationstoreach five decimal place accuracy:
3 x 2
20 x
x ( 3 x
7) 3
7) 2
2(0
.
10(0
.
5
x
=
0
.
735 36
0
.
7 [ 3(0
.
7)
20 ]
735 36) 3
735 36) 2
2(0
.
10(0
.
5
x
=
0
.
734 60
0
.
735 36 [ 3(0
.
735 36)
20 ]
EXAMPLE 4.7
Find the smallest positivezeroof
x 4
4 x 3
45 x 2
f ( x )
=
6
.
+
6
.
+
20
.
538 x
31
.
752
Solution
60
40
20
0
-20
-40
0
1
2
3
4
5
x
Search WWH ::




Custom Search