API Reference
Module query
- class sympy_addons.query.Node(parent, expr, path)
A node in the expression tree.
Wraps around the SymPy expression node and contains path information. Makes only sense in the context of expression and path queries, where we have a containing expression.
- exception sympy_addons.query.NotFoundException
- exception sympy_addons.query.NotUniqueException
- class sympy_addons.query.Query(**kwargs)
A class for querying SymPy expression.
- run(expr)
Run the query on an expression.
- exception sympy_addons.query.QueryException
- sympy_addons.query.get_epath(subexpr, containing_expr)
Get the unique epath for a subexpression within a given expression.
- Parameters
subexpr (Basic) – The subexpression to get epaths for.
containing_expr (Basic) – The containing expression.
- Returns
out – The epath string for the matching subexpression.
- Return type
str
- Raises
NotUniqueException – if the subexpression is not unique in the containing expression.
NotFoundException – if the subexpression is not found in the containing expression.
- sympy_addons.query.get_epaths(subexpr, containing_expr)
Get all epaths for a subexpression within a given expression.
- Parameters
subexpr (Basic) – The subexpression to get epaths for.
containing_expr (Basic) – The containing expression.
- Returns
out – A list of epath-strings matching the subexpression.
- Return type
list
- sympy_addons.query.make_expression_tree(expr)
Build the expression tree with path information.
- Parameters
expr (Basic) – The root expression for the expression tree to build.
- Returns
out – The root node of the expression tree.
- Return type
- sympy_addons.query.walk_tree(root_node)
Returns a list of all nodes in the expression tree.
Module graphviz
- sympy_addons.graphviz.plot_graph(expr)
Make a graph plot of the internal representation of SymPy expression.