Tuesday, January 10, 2012

Parameterizing Programs by Arithmetic

Veronica continues to explore Scala for parameterizing programs over
different implementations of numbers. There is now a better
implementation of the hierarchy of numeric type classes. Also, there
are now instances of these classes with Double, symbolic numbers
(expressions) and differentiable numbers. For Double the operations
are as expected. For symbolic numbers, the operations build more or
less simplified expressions. For differentiables the operations
calculate all derivatives at a given point. The combination of
symbolic numbers and differentiables calculates expressions for the
derivatives. The ideas for doing this are from Lennart Augustsson's
blog on overloading numbers. There is still a lot of place for
improvement and extensions, for example better simplifications for the
symbolic numbers, more examples using derivatives and more numeric
types that instantiate the type classes (the first candidates are the
constructive reals implemented in Java (Boehm and Cartwright))