# [PYTHON MATRIX-SIG] Fast evaluation of numerical expressions

**Hinsen Konrad
**
hinsenk@ere.umontreal.ca

*Sat, 13 Jan 1996 09:32:56 -0500*

This sounds like a useful idea. Please proceed.
As soon as I find some spare time...
(I particularly like the idea of using a 'variable' data type which
can be subjected to normal operations, yielding a data structure
representing the expression structure. This could be used in a
symbolic algebra package, as well...)
Indeed. Symbolic algebra in Python would be neat...
A nice feature of this approach is that existing code can be compiled
without modification. Any Python function foo(x) that consists of a
linear sequence of statements (no conditionals, no loops) can be
compiled as simply as
compiled_foo = foo(variable(types.FloatType))
The tricky part will be the optimizer. I'd like to have at least
extraction of common subexpressions, which occur rather often
in numerical expressions.
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal | Fax: +1-514-343-7586
C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7 | Francais (phase experimentale)
-------------------------------------------------------------------------------
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================