Differentiation in PASCAL-SC: type GRADIENT

Louis B. Rall · ACM Transactions on Mathematical Software · 1984

In scientific computation, there is often need for the derivatives, as well as the values, of functions defined by computer programs.Here it is shown how automatic differentiation can be carried out in a modern computer language which permits user-defined operators and data types.The specific language used is Pascal-SC, and differentiation is implemented for variables of type GRADIENT, which consists of the value of a function of n real variables and its gradient vector of first partial derivatives with respect to the independent variables.Calculations of the results of operators or functions apphed to GRADIENT variables are carried out according to the well-known rules for evaluation and differentiation of sums, differences, products, and so on.Since the differentiation is performed at compile time, the code produced is comparable in compactness and execution time to that obtained if numerical approximations are used for derivatives, and the theoretical and practical problems associated with numerical differentiation are avoided.Pascal-SC source code is given for the necessary operators and standard functions, and it is shown how to prepare code for arbitrary differentiable functions to add to the hbrary if desired.The effectiveness of the use of type GRADIENT is shown by an example of the solution of a system of nonlinear equations by Newton's method.

Read the paper · More papers on PaperTik