calculate_gradient
Compute the gradient of a scalar field to obtain its vector field representation, enabling advanced symbolic algebra operations with precise mathematical results.
Instructions
Calculates the gradient of a scalar field using SymPy's gradient function.
Args:
scalar_field_key: The key of the scalar field expression.
Example:
# First create a coordinate system
create_coordinate_system("R")
# Create a scalar field f = x^2 + y^2 + z^2
scalar_field = introduce_expression("R_x**2 + R_y**2 + R_z**2")
# Calculate gradient
grad_result = calculate_gradient(scalar_field)
# Returns (2x, 2y, 2z)
Returns:
A key for the gradient vector field expression.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
scalar_field_key | Yes |
Input Schema (JSON Schema)
{
"properties": {
"scalar_field_key": {
"title": "Scalar Field Key",
"type": "string"
}
},
"required": [
"scalar_field_key"
],
"title": "calculate_gradientArguments",
"type": "object"
}