We present a purely functional implementation of the computational differentiation tools — the well known numeric (i.e., not symbolic) techniques which permit one to compute point-wise derivatives of functions defined by computer programs economically and exactly (with machine precision). We show how the use of lazy evaluation permits a transparent and elegant construction of the entire infinite tower of derivatives of higher order for any expressions present in the program. The formalism may be useful in various problems of scientific computing which often demand a hard and ungracious human preprocessing before writing the final code. Some concrete examples are given.

The aim of this paper is to show the usefulness of lazy functional techniques in the domain of scientific computing. We present a functional implementation of the Computational Differentiation techniques which permit an effi- cient computation of (point-wise, numeric) derivatives of functions defined by computer programs. A previous version of this work has been presented at the 1998 International Conference on Functional Programming [14].

A fast and accurate differentiation is essential for many problems in applied mathematics. The derivatives are needed for all kind of approximations: gradient methods of equation solving, many sorts of asymptotic expansions, etc. They are needed for optimization and for the sensitivity and stability analysis of dynamical systems. They permit the computation of geometric properties of curves and surfaces in 3D modelling, image synthesis and animation. In the domain of differential equations, they are used not only directly, but also as an analytic tool for evaluating the numerical stability of a given discrete algorithm. The construction of equations of motion is often based on variational methods, which involve differentiation. Even in discrete mathematics the differentiation is useful to compute some combinatorial factors from the appropriate partition functions, as presented in Knuth, Graham and Patashnik’s textbook on concrete mathematics.

Download pdf Functional Differentiation of Computer Programs