Automatic Differentiation

In mathematics and computer algebra, automatic differentiation (AD), sometimes alternatively called algorithmic differentiation, is a method to numerically evaluate the derivative of a function specified by a computer program. Two classical methods of doing differentiation are: symbolically differentiate the function as an expression, and evaluate it at the point; or use numerical differentiation. These methods run into problem areas: symbolic differentiation works at low speed, and faces the difficulty of converting a computer program into a single expression, while finite differences can introduce round off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where the complexity and errors increase. Automatic differentiation solves all of these problems. AD exploits the fact that any computer program that implements a vector function y = F(x) (generally) can be decomposed into a sequence of elementary assignments, any one of which may be trivially differentiated by a simple table lookup.