Expression Calculator
calculateEvaluate mathematical expressions from simple arithmetic to trigonometry and logarithms, with variable substitution for dynamic calculations.
Instructions
Evaluate mathematical expressions using SymPy.
Supports: - Arithmetic: +, -, *, /, ^ - Trigonometry: sin, cos, tan, asin, acos, atan - Logarithms: log, ln, exp - Constants: pi, e - Functions: sqrt, abs
Examples:
SIMPLE ARITHMETIC: expression="2 + 2" Result: 4
TRIGONOMETRY: expression="sin(pi/2)" Result: 1.0
WITH VARIABLES: expression="x^2 + 2*x + 1", variables={"x": 3} Result: 16
MULTIPLE VARIABLES: expression="x^2 + y^2", variables={"x": 3, "y": 4} Result: 25
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Optional annotation to label this calculation (e.g., 'Bond A PV', 'Q2 revenue'). Appears in results for easy identification. | |
| output_mode | No | Output format: full (default), compact, minimal, value, or final. See batch_execute tool for details. | full |
| expression | Yes | Mathematical expression (e.g., '2+2', 'sin(pi/2)', 'x^2+1') | |
| variables | No | Variable substitutions (e.g., {'x': 5, 'y': 10}) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |