Copilot Calculator Tool
Flux Copilot includes a powerful calculator tool that allows you to evaluate mathematical expressions and perform engineering calculations directly from the chat interface. This tool helps you quickly solve equations without having to switch to a separate calculator application.
Overview
The calculator tool enables you to:
- Evaluate mathematical expressions of varying complexity
- Perform engineering calculations relevant to circuit design
- Work with arrays and matrices for more complex operations
- Get results in a clear, formatted output
- Extract and evaluate equations from datasheets

How to Use the Calculator Tool
To evaluate mathematical expressions using Copilot, use the @calculator
tool in your query:
When you use the @calculator
tool, Copilot will:
- Parse the mathematical expression
- Check for any undefined variables or functions
- Evaluate the expression using the mathjs library
- Return the result in a formatted output
Supported Operations
The calculator tool supports a wide range of mathematical operations:
Basic Arithmetic
- Addition, subtraction, multiplication, division
- Exponentiation and square roots
- Modulo and integer division
Trigonometric Functions
- Sine, cosine, tangent (and their inverses)
- Support for both radians and degrees (using
deg
suffix)
Logarithmic and Exponential Functions
- Natural logarithm (ln) and base-10 logarithm (log10)
- Exponential function (exp)
Engineering Functions
- Unit conversions (e.g., ohms to kilohms)
- Engineering notation (e.g., 1k = 1000)
- Complex number operations
Matrix and Array Operations
- Matrix creation and manipulation
- Vector operations
- Array indexing and slicing
Example Calculations
Here are some examples of how you can use the calculator tool:
Circuit Calculations
Power and Energy Calculations
Timing and Frequency Calculations
Result Formatting
The calculator tool formats results based on the type of calculation:
Scalar Values
Simple numerical results are displayed with appropriate precision and units when applicable.
Arrays and Vectors
One-dimensional arrays are displayed in a tabular format with index and value columns.
Matrices
Two-dimensional arrays (matrices) are displayed in a tabular format with row indices and values.
Complex Numbers
Complex numbers are displayed in the form a + bi
where a
is the real part and b
is the imaginary part.
Tips for Effective Calculations
To get the most out of the calculator tool:
Use engineering notation - You can use suffixes like k, M, m, u, n, p (e.g., 10k for 10,000 or 1u for 0.000001).
Include units for clarity - While not required for calculation, adding units like V, A, or ohm helps with readability.
Use parentheses for complex expressions - Ensure correct order of operations by using parentheses in complex expressions.
Break down complex calculations - For very complex calculations, consider breaking them into smaller steps.
Extracting Equations from Datasheets
A powerful feature of the calculator tool is its ability to extract and evaluate equations from datasheets:
- Attach a datasheet to your chat
- Use the
@calculator
tool to reference an equation in the datasheet - Provide the values for the variables in the equation
For example:
Limitations
While the calculator tool is powerful, it has some limitations to be aware of:
- The tool cannot evaluate expressions with undefined variables
- Very complex mathematical operations might require breaking down into simpler steps
- The tool does not support solving equations (finding x where f(x) = 0)
- Some specialized engineering functions might not be available
- The tool does not maintain state between calculations
Related Features
The calculator tool works well with other Copilot capabilities:
- Copilot Help Tool - Search Flux documentation for guidance
- Copilot File Tool - Extract information from datasheets
- Copilot Code Tool - Generate Python scripts for more complex calculations
- Copilot Simulator Tool - Run SPICE circuit simulations
- Getting Started With Copilot - Learn the basics of using Copilot