Dual Numbers


The math.dual vocabulary implements dual numbers, along with arithmetic methods for working with them. Many of the functions in math.functions are extended to work with dual numbers.

Dual numbers are ordered pairs <o,e>--an ordinary part and an epsilon part--with component-wise addition and multiplication defined by <o1,e1>*<o2,e2> = <o1*o2,e1*o2 + e2*o1>. They are analagous to complex numbers with i^2 = 0instead of i^2 = -1. For well-behaved functions f, f(<o1,e1>) = f(o1) + e1*f'(o1), where f' is the derivative of f.