
198 Chapter 14. Numerical Methods
x
3
≈ 0.5787130827, x
4
≈ 0.5787136435.
We can see that x
3
(only three iterations) is very close (to the 6th decimal
place) to the true root which is x
∗
≈ 0.57871364351972, while x
4
is
accurate to the 10th decimal plac e .
We have seen that Newto n-Raphson’s method is very efficient and
that is why it is so widely used. Using this method, we can virtually
solve almost all root-finding problems. However, this method is not
applicable to carrying out integration.
14.3 Numerical Integration
For any smooth function, we can always calculate its derivatives by
direct differentiation; however, integration is often difficult even for
seemingly simple integrals such as the error function
erf(x) =
2
√
π
Z
x
0
e
−u
2
du. (14.9)
The integra tion of this simple integrand exp(−u
2
) does not lead
to any simple explicit expression, which is why it is often written as
erf(), referred to as the error function. If we pick up a mathematical
handb ook, we know that erf(0) = 0, and erf(∞) = 1, while
erf(0.5) ≈ 0.52049, erf(1) ≈ 0.84270. (1 4.10)
If we want to calculate such integrals , numerical integration is the best
alternative.
Now if we want to numerically evaluate the following integral
I =
Z
b
a
f(x)dx, (14 .11)
where a and b are fixed and finite; we know that the value of the integra l
is exactly the total area under the curve y = f(x) between a and b.
As both the integral and the area can be considered as the sum of
the values over many small intervals, the simplest way of evaluating
such numerical integration is to divide up the integral interval into n
equal small sections and split the area into n thin strips of width h
so that h ≡ ∆x = (b − a)/n, x
0
= a and x
i
= ih + a(i = 1, 2, ..., n).
The values of the functions at the dividing points x
i
are denoted as
y
i
= f (x
i
), and the value at the midpoint between x
i
and x
i+1
is
labeled as y
i+1/2
= f
i+1/2
y
i+1/2
= f(x
i+1/2
) = f
i+1/2
, x
i+1/2
=
x
i
+ x
i+1
2
. (14.12)