MathML representation of derivations
This example derives the configurational partition function (integral) for two particles interacting via a Lennard-Jones potential.
The importance of this example is that all the mathematical steps in the derivation and the generation of the
final source code are performed in a manner that can be checked algorithmically.
This is the MathML (xhtml) output from the model derivation.
The generated python code (direct evaluation by python is the only code generation target right now):
The code for this is located in my github sympy fork, in the derivation_modeling branch. The added code in is in the
- do_int.py Perform the top level integration
- ptrap_gen.py Implementation of the trapezoidal rule (fixed 4/26/2011)
prototype/ directory, with a few small hacks in the rest of the sympy code to make it work. See the Readme.txt file in that directory for more information about the files there.
To generate the MathML/xhtml output, run quadrature/trapezoid.py, stat_mech/lj.py, and stat_mech/int_lj_n2d2.py.
To generate the python code, run stat_mech/final.py (generates do_int.py), and run quadrature/convert_trap.py (generates ptrap_gen.py)