sympy/sympy — pull request #2570 by rlamy (2013-11-03 02:03:47+00:00)
Title: KanesMethod optimisation

This simply hoists some constants out of loops.

It cuts down the run-time by ~40% when running [the pydy-code-gen benchmark](https://github.com/PythonDynamics/pydy-code-gen/blob/master/pydy_code_gen/tests/models.py#L97).