Utilities for dealing with exressions

Parser

pymbolic.parse(expr_str)

Return a pymbolic.primitives.Expression tree corresponding to expr_str.

The parser is also relatively easy to extend. See the source code of the following class.

class pymbolic.parser.Parser

Compiler

class pymbolic.compiler.CompiledExpression(expression, variables=[])

This class encapsulates an expression compiled into Python bytecode for faster evaluation.

Its instances (unlike plain lambdas) are pickleable.

Parameters:variables – The first arguments (as strings or pymbolic.primitives.Variable instances) to be used for the compiled function. All variables used by the expression and not present here are added in alphabetical order.
__call__(*args)

sympy interface

class pymbolic.sympy_interface.SympyToPymbolicMapper
__call__(expr)
class pymbolic.sympy_interface.PymbolicToSympyMapper
__call__(expr)