Arithmetic Calculator
enhancedtoolkits.calculators.arithmetic.ArithmeticCalculatorTools ¶
Bases: BaseCalculatorTools
Calculator for basic arithmetic operations.
Source code in src/enhancedtoolkits/calculators/arithmetic.py
Functions¶
add ¶
Add two numbers and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | First number | required |
b | float | Second number | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing addition result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
subtract ¶
Subtract second number from first and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | First number | required |
b | float | Second number | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing subtraction result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
multiply ¶
Multiply two numbers and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | First number | required |
b | float | Second number | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing multiplication result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
divide ¶
Divide first number by second and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | Numerator | required |
b | float | Denominator | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing division result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
exponentiate ¶
Raise first number to the power of the second number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | Base | required |
b | float | Exponent | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing exponentiation result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
square_root ¶
Calculate the square root of a number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | float | Number to calculate square root of | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing square root result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
factorial ¶
Calculate the factorial of a number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | int | Number to calculate factorial of (must be non-negative integer) | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing factorial result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
is_prime ¶
Check if a number is prime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | int | Number to check for primality | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing prime check result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
modulo ¶
Calculate the remainder when a is divided by b.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | float | Dividend | required |
b | float | Divisor | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing modulo result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
absolute ¶
Calculate the absolute value of a number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | float | Number to find absolute value of | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing absolute value result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
round_number ¶
Round a number to specified decimal places.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | float | Number to round | required |
decimals | int | Number of decimal places (default: 0) | 0 |
Returns:
| Type | Description |
|---|---|
str | JSON string containing rounded number result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
log ¶
Calculate logarithm with specified base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | float | Number to calculate logarithm of | required |
base | float | Logarithm base (default: 10.0) | 10.0 |
Returns:
| Type | Description |
|---|---|
str | JSON string containing logarithm result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
ln ¶
Calculate natural logarithm (base e).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | float | Number to calculate natural logarithm of | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing natural logarithm result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
gcd ¶
Calculate greatest common divisor of two integers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | int | First integer | required |
b | int | Second integer | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing GCD result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
lcm ¶
Calculate least common multiple of two integers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a | int | First integer | required |
b | int | Second integer | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing LCM result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
mean ¶
Calculate arithmetic mean of a list of numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
numbers | List[float] | List of numbers | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing mean result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
median ¶
Calculate median of a list of numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
numbers | List[float] | List of numbers | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing median result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
standard_deviation ¶
Calculate standard deviation of a list of numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
numbers | List[float] | List of numbers | required |
Returns:
| Type | Description |
|---|---|
str | JSON string containing standard deviation result |
Source code in src/enhancedtoolkits/calculators/arithmetic.py
get_llm_usage_instructions staticmethod ¶
Return short, text-first usage instructions for arithmetic tools.