Algebraic Python


An idea for a Python library: A computer-algebra system designed to interface neatly with Numeric Python. That is, with the same capacity for dealing with multi-dimensional arrays.

Whereas normally arithmetic expressions are immediately evaluated, an expression in Algebraic Python would construct a data-structure representing the expression. The expression might then be evaluated by substituting in some values, or manipulated further: simplified, differentiated, integrated, converted into C code, estimate/minimize level of error introduced by floating point calculation.

Differentiation is an operation that is useful in numerical optimization, and furthermore is trivial to perform symbolicly. Algebraic Python would have an immediate application to such optimization problems. Using the multi-dimensional array concept, differentiating over a matrix of unknown variable would yield a matrix of results, and differentiating a matrix-valued expression over a matrix of unknown variables would yield of matrix of matricies (ie a higher dimensional matrix). Such bulk derivatives could then be simplified or manipulated further, without need to consider each derivative individually.

Integration is somewhat harder. An extensible table of integrals would be required. The main advantage I see here is a reduction in the chance of error as compared to integration by hand, eg in implementation of MML estimators.