Array Operations
array_operationsPerform element-wise operations on 2D arrays including add, subtract, multiply, divide, and power, supporting array-to-array and array-to-scalar computations.
Instructions
Perform element-wise operations on arrays using Polars.
Supports array-array and array-scalar operations.
Examples:
SCALAR MULTIPLICATION: operation="multiply", array1=[[1,2],[3,4]], array2=2 Result: [[2,4],[6,8]]
ARRAY ADDITION: operation="add", array1=[[1,2]], array2=[[3,4]] Result: [[4,6]]
POWER OPERATION: operation="power", array1=[[2,3]], array2=2 Result: [[4,9]]
ARRAY DIVISION: operation="divide", array1=[[10,20],[30,40]], array2=[[2,4],[5,8]] Result: [[5,5],[6,5]]
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 |
| operation | Yes | Element-wise operation to perform | |
| array1 | Yes | First 2D array (e.g., [[1,2],[3,4]]) | |
| array2 | Yes | Second array, scalar, or JSON string |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |