Evaluating operation DAGs on big inputs was very costly, but I managed to overcome it in a few lines of code thanks to 2 features of sympy:
- symbolic reduction
- numexpr integration
Sympy was really of great help, and I hoped it could be a motivating example to put in the "Projects using SymPy" section of the homepage (http://www.sympy.org/en/index.html).