differentiate_expression
Compute derivatives of mathematical expressions with respect to a specified variable using symbolic differentiation. Supports higher-order derivatives for advanced calculus and algebraic tasks.
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 |
---|---|---|---|
expr_key | Yes | ||
order | No | ||
var_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"expr_key": {
"title": "Expr Key",
"type": "string"
},
"order": {
"default": 1,
"title": "Order",
"type": "integer"
},
"var_name": {
"title": "Var Name",
"type": "string"
}
},
"required": [
"expr_key",
"var_name"
],
"title": "differentiate_expressionArguments",
"type": "object"
}