1. A computing system, comprising a processor; and a first memory in communication with the processor, the first memory storing programming instructions executable by the processor to: accept a function expressed as a program in a formal language of a formal system; automatically process the program to yield an output; and store the output of the processing in a second memory; wherein the formal language includes at least one automatic differentiation (AD) construct that takes as its input a first object expressed in the formal language, provides as its output a second object expressed in the formal language, where the second object calculates the derivative of the first object, and wherein the second object is produced by transforming the first object within the formal system.