Page 80 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 80
Numerical Methods 69
where i = 1, 2, . . ., n - I
Axi = xi+, - xi
If the xl are equally spaced by Ax, then the preceding equation becomes
There are n - 1 equations in n + 1 unknowns and the two necessary additional
equations are usually obtained by setting
g”(x,) = 0 and g”(x,) = 0
and g(x) is now referred to as a natural cubic spline. g”(x,,) or g”(x,) may alternatively
be set to values calculated so as to make g’ have a specified value on either or
both boundaries. The cubic appropriate for the interval in which the x value
lies may now be calculated (see “Solutions of Simultaneous Linear Equations”).
Extrapolation is required if f(x) is known on the interval [a,b], but values of
f(x) are needed for x values not in the interval. In addition to the uncertainties
of interpolation, extrapolation is further complicated since the function is fixed
only on one side. Gregory-Newton and Lagrange formulas may be used for
extrapolation (depending on the spacing of the data points), but all results
should be viewed with extreme skepticism.
Roots of Equations
Finding the root of an equation in x is the problem of determining the values
of x for which f(x) = 0. Bisection, although rarely used now, is the basis of several
more efficient methods. If a function f(x) has one and only one root in [a,b],
then the interval may be bisected at xm = (a + b)/2. If f(xm) f(b) < 0, the root
is in [x,,b], while if f(x,) f(b) > 0, the root is in [a,xm]. Bisection of the
appropriate intervals, where XI = (a‘ + b’)/2, is repeated until the root is located
f E, E being the maximum acceptable error and E I 1/2 size of interval.
The Regula Falsa method is a refinement of the bisection method, in which
the new end point of a new interval is calculated from the old end points by
Whether xm replaces a or replaces b depends again on the sign of a product, thus
if f(a) f(xm) < 0, then the new interval is [a,xm]
or
if f(x,) f(b) < 0, then the new interval is [x,,b]