Determining calculation order for group of related calculations

python at bdurham.com python at bdurham.com
Fri Jan 28 18:29:41 EST 2011


Wondering if there's a Python library or algorithm for
determining the order in which a group of calculations should be
performed when some calculations reference the result of other
equations. I don't need anything as fancy as a spreadsheet
engine, however I do need to detect recursive equations and treat
these situations as errors.

In terms of an example: What I would like to do is order the
following equations such that all the dependent variables are
calculated before they are referenced by later calculations.

a + b + c = d
a + b + d = e
a + e = f
d + e + f = g
a + e = h

Thank you,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110128/d00a38cf/attachment.html>


More information about the Python-list mailing list