Export and import of SymPy expressions

Converting to and from SymPy


Converts the given Myokit expression to a SymPy expression., model=None)

Converts the given Sympy expression to a myokit one. Any variable names will be resolved against the given model.


The standard interface for exporting and accessing expression writers is provided:


Returns a dict of all expression writers available in this module.

class myokit.formats.sympy.SymPyExpressionWriter

This ExpressionWriter converts Myokit expressions to SymPy expressions.

The returned type is a SymPy object, not a string!


Converts an equation to a sympy Eq object.


Converts an expression to a sympy Eq object.

Sets a naming function, will be called to get the variable name from a

myokit.LhsExpression object.

The argument f should be a function that takes an LhsExpression as input and returns a string.

class myokit.formats.sympy.SymPyExpressionReader(model=None)

Converts Sympy expressions to Myokit expressions.

Any variable names will be resolved against the given model. If no model is given, string names will be used instead of myokit Variable objects.


Converts the Sympy expression e to a myokit.Expression.


Changes the model used by this reader to resolve variable names.