Beginning to port code to python in order to use sympy