differentiate_expression
Computes symbolic derivatives of an expression with respect to a chosen variable, supports higher-order differentiation, and returns a key for the resulting expression.
Instructions
Differentiates an expression with respect to a variable using SymPy's diff function.
Args:
expr_key: The key of the expression (previously introduced) to differentiate.
var_name: The name of the variable to differentiate with respect to.
order: The order of differentiation (default is 1 for first derivative).
Example:
# Introduce a variable
intro("x", [Assumption.REAL], [])
# Create an expression to differentiate: x^3
expr_key = introduce_expression("x**3")
# First derivative
first_deriv = differentiate_expression(expr_key, "x")
# Returns 3x²
# Second derivative
second_deriv = differentiate_expression(expr_key, "x", 2)
# Returns 6x
Returns:
A key for the differentiated expression.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order | No | ||
| expr_key | Yes | ||
| var_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |