introduce_expression
Parse and store symbolic expressions with SymPy, assigning them to temporary or user-defined variables. Supports equations and matrices while applying canonicalization rules by default.
Instructions
Parses a sympy expression string using available local variables and stores it. Assigns it to either a temporary name (expr_0, expr_1, etc.) or a user-specified global name.
Uses Sympy parse_expr to parse the expression string.
Applies default Sympy canonicalization rules unless canonicalize is False.
For equations (x^2 = 1) make the input string "Eq(x^2, 1") not "x^2 == 1"
Examples:
{expr_str: "Eq(x^2 + y^2, 1)"}
{expr_str: "Matrix(((25, 15, -5), (15, 18, 0), (-5, 0, 11)))"}
{expr_str: "pi+e", "expr_var_name": "z"}
Input Schema
Name | Required | Description | Default |
---|---|---|---|
canonicalize | No | ||
expr_str | Yes | ||
expr_var_name | No |
Input Schema (JSON Schema)
{
"properties": {
"canonicalize": {
"default": true,
"title": "Canonicalize",
"type": "boolean"
},
"expr_str": {
"title": "Expr Str",
"type": "string"
},
"expr_var_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Expr Var Name"
}
},
"required": [
"expr_str"
],
"title": "introduce_expressionArguments",
"type": "object"
}