Page 231 - Excel for Scientists and Engineers: Numerical Methods
P. 231
208 EXCEL: NUMERICAL METHODS
as a Taylor series expansion, e.g.,
CI = F1 (XI + Axl, . . -9 xn + Ax,)
+
.
.,
.
= F~(~~, + kl - ... + Ax,,- *I + higher-order terms
x,,)
*I
x2,
a1 a,*
where the Axi values are the corrections to the initial estimates of the xi values,
for example, XI = XI + Axl.
As before, we can obtain a good approximation to the - terms by
*i
aj
calculating AF'i/Axj (see Chapter 6, "Differentiation").
The problem has thus been reduced to a linear system
... ...
an
that can be solved by methods that have already been described in this chapter.
The solution process is as follows: with initial estimates of the xi values, we
z.
obtain the --!- values by numerical differentiation. We set up the matrix of
ahci
partial derivatives augmented by the vector of constants and solve for the Ax,
variables. We then use these to calculate improved estimates of the xi values,
z.
calculate new values of the 2 terms and solve for the Ax, variables. We repeat
ahci
the process until the magnitude of the Ax, variables is smaller than a specified
tolerance.
The VBA code for the SirnultEqNL function is shown in Figure 9-14. The
syntax of the function is SimultEqNL( equations, variab/es,constants).
The arguments have the same meaning as for the preceding GaussElirn,
GaussJordan, or GaussSeidel functions. The function returns the results vector;
since the function is an array function, you must select an appropriately sized
range of cells and press CTRL+SHIFT+ENTER (Windows) or
COMMAND+RETURN or CTRL+SHIFT+RETURN (Macintosh).