Algorithm 314: Finding a solution of N functional equations in N unknowns


p r o c e d u r e ndinvt (.functions, initstep, error, cycles, x, f , accest, n) ; v a l u e n; procedure functions; real initstep, error; i n t e g e r cycles, n; a r r a y x, f , accest; c o m m e n t This procedure performs inverse interpolat ion in n dimensions, i.e., i t will find a set of values for n variables x, such tha t n functions f (x) are zero. A more sophist icated technique, suitable for large values of n, has been developed by S. M. Robinson (Interpolat ive Solution of Systems of Nonlinear Equat ions, S I A M Journal of Numerical Analysis , 3 (1966), 650-658). I t can also be used to fit a curve with n arbi t rary parameters to a set of points, the n functions being formed, in this case, by equating to zero the differential of the sum of the squares of the residues with respect to each parameter in turn. The functions required are specified by a procedure of the form funct ions (f, x) where f and x are declared as arrays from 1 to n: This procedure should calculate the n functions from a set of values given in x, placing the results in f. The first s tep is made by forming partial derivatives over an interval initstep. h0 -6 should be suitable for values of x of the order 1 to 10. Exi t from the procedure will occur if: (i) the root sum square of the x increments is less than error. If error is negative, this condition must be satisfied for ] error [, and in addit ion this process is continued until the root sum square of the incrementsfails to decrease or (ii) the number of i terat ions is greater than cycles, implying tha t too much accuracy has been requested or (iii) the specified equations are singular. In this case exit is by a jump to a label fails. On entry, the array x should contain the s tar t ing values. On exit, the array x will contain the accurate root, f the residues and accest the last increments made to x as a measure of the accuracy. This procedure calls on a global procedure eqnsolve (A, b, n, label), which solves n linear simultaneous equations in n unknowns A x = b, placing the result in b. If A is singular, i t is assumed tha t an exit is made by a jump to label; b e g i n r ea l work, sumsqres, prevres; i n t e g e r i, j , count; ]Boolean switch; a r r a y prevf[1 :n], eopydelf[1 :n, 1 :n], delx, dell[1 :n, 1 : n+ l ] ; funct ions(prevf , x) ; for i := 1 s t e p 1 u n t i l n do b e g i n x[i] := x[i] + initstep; funct ions (f, x) ; for j := 1 s t e p 1 u n t i l n do b e g i n dell[i, j] := f[j] -prevfgj];

DOI: 10.1145/363790.363823

Cite this paper

@article{Dulley1967Algorithm3F, title={Algorithm 314: Finding a solution of N functional equations in N unknowns}, author={D. B. Dulley and Michael L. V. Pitteway}, journal={Commun. ACM}, year={1967}, volume={10}, pages={726} }