POST/v1/math/evaluate1 credit / call
Expression evaluator
Safely evaluate a calculator expression (supports sin/cos/tan, sqrt, ln, log, exp, ^, %, !).
| Parameter | Type | Required | Description |
|---|
| expression | string | Yes | Expression to evaluate, e.g. "sqrt(16)+2^3". |
| angleMode | string | No | deg | rad. Default: deg. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/evaluate \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"expression":"sqrt(16)+2^3"}'
Response
{
"ok": true,
"data": {
"result": 12
}
}
POST/v1/math/average1 credit / call
Average / mean
Compute count, sum, mean, median, minimum and maximum for a list of numbers.
| Parameter | Type | Required | Description |
|---|
| values | string | Yes | Array of numbers, e.g. [1,2,3]. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/average \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"values":[1,2,3,4]}'
Response
{
"ok": true,
"data": {
"count": 4,
"sum": 10,
"mean": 2.5,
"median": 2.5,
"minimum": 1,
"maximum": 4
}
}
POST/v1/math/percentage1 credit / call
Percentage calculations
Compute a percentage of a value, a part-of-whole ratio, or percentage change between two values.
| Parameter | Type | Required | Description |
|---|
| mode | string | Yes | of | ratio | change. |
| a | number | Yes | mode=of: percentage; mode=ratio: part; mode=change: original value. |
| b | number | Yes | mode=of: value; mode=ratio: whole; mode=change: updated value. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/percentage \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"mode":"of","a":20,"b":150}'
Response
{
"ok": true,
"data": {
"result": 30
}
}
POST/v1/math/fraction1 credit / call
Fraction arithmetic
Add, subtract, multiply or divide two fractions and simplify the result.
| Parameter | Type | Required | Description |
|---|
| firstNumerator | number | Yes | Numerator of the first fraction. |
| firstDenominator | number | Yes | Denominator of the first fraction. |
| secondNumerator | number | Yes | Numerator of the second fraction. |
| secondDenominator | number | Yes | Denominator of the second fraction. |
| operator | string | Yes | + | - | * | /. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/fraction \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"firstNumerator":1,"firstDenominator":2,"secondNumerator":1,"secondDenominator":3,"operator":"+"}'
Response
{
"ok": true,
"data": {
"numerator": 5,
"denominator": 6,
"whole": 0,
"remainder": 5,
"decimal": 0.833
}
}
POST/v1/math/statistics1 credit / call
Descriptive statistics
Compute mean, median, range, modes, variance and standard deviation (population and sample) for a list of numbers.
| Parameter | Type | Required | Description |
|---|
| values | string | Yes | Array of numbers. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/statistics \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"values":[2,4,4,4,5,5,7,9]}'
Response
{
"ok": true,
"data": {
"mean": 5,
"populationStandardDeviation": 2
}
}
POST/v1/math/ratio1 credit / call
Ratio simplification
Simplify a ratio of two whole numbers to lowest terms.
| Parameter | Type | Required | Description |
|---|
| a | number | Yes | First whole number. |
| b | number | Yes | Second whole number. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/ratio \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"a":8,"b":12}'
Response
{
"ok": true,
"data": {
"simplified": [
2,
3
]
}
}
POST/v1/math/quadratic1 credit / call
Quadratic equation solver
Solve ax²+bx+c=0: discriminant, real or complex roots, and vertex.
| Parameter | Type | Required | Description |
|---|
| a | number | Yes | Coefficient a (must not be zero). |
| b | number | Yes | Coefficient b. |
| c | number | Yes | Coefficient c. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/quadratic \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"a":1,"b":-3,"c":2}'
Response
{
"ok": true,
"data": {
"discriminant": 1,
"roots": [
"2",
"1"
],
"vertexX": 1.5,
"vertexY": -0.25
}
}
POST/v1/math/power1 credit / call
Exponents and roots
Raise a number to a power, or compute its nth root.
| Parameter | Type | Required | Description |
|---|
| mode | string | Yes | power | root. |
| value | number | Yes | Base (mode=power) or radicand (mode=root). |
| n | number | Yes | Exponent (mode=power) or root degree, >=2 (mode=root). |
Request
curl -X POST https://toolsonduty.com/api/v1/math/power \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"mode":"power","value":2,"n":10}'
Response
{
"ok": true,
"data": {
"result": 1024
}
}
POST/v1/math/round1 credit / call
Configurable rounding
Round a number to a given number of decimal places using nearest, up, down or truncate.
| Parameter | Type | Required | Description |
|---|
| value | number | Yes | Value to round. |
| places | number | No | Decimal places, -10 to 10. Default: 0. |
| mode | string | No | nearest | up | down | truncate. Default: nearest. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/round \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"value":3.14159,"places":2}'
Response
{
"ok": true,
"data": {
"result": 3.14
}
}
POST/v1/math/lcm1 credit / call
Least common multiple
Compute the least common multiple of a list of whole numbers.
| Parameter | Type | Required | Description |
|---|
| values | string | Yes | Array of whole numbers (2+). |
Request
curl -X POST https://toolsonduty.com/api/v1/math/lcm \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"values":[4,6]}'
Response
{
"ok": true,
"data": {
"result": 12
}
}
POST/v1/math/gcf1 credit / call
Greatest common factor
Compute the greatest common factor of a list of whole numbers.
| Parameter | Type | Required | Description |
|---|
| values | string | Yes | Array of whole numbers (2+). |
Request
curl -X POST https://toolsonduty.com/api/v1/math/gcf \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"values":[12,18]}'
Response
{
"ok": true,
"data": {
"result": 6
}
}
POST/v1/math/prime-factors1 credit / call
Prime factorization
Factorize a whole number (2 or more) into its prime factors with exponents.
| Parameter | Type | Required | Description |
|---|
| value | number | Yes | Whole number, 2 or more. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/prime-factors \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"value":60}'
Response
{
"ok": true,
"data": {
"factors": [
{
"prime": 2,
"exponent": 2
},
{
"prime": 3,
"exponent": 1
},
{
"prime": 5,
"exponent": 1
}
]
}
}
POST/v1/math/random1 credit / call
Secure random integers
Generate secure random integers in an inclusive range, optionally without repeats.
| Parameter | Type | Required | Description |
|---|
| minimum | number | Yes | Range minimum. |
| maximum | number | Yes | Range maximum. |
| count | number | No | How many to generate (1-1000). Default: 1. |
| unique | boolean | No | Disallow repeated values. Default: false. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/random \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"minimum":1,"maximum":100,"count":5}'
Response
{
"ok": true,
"data": {
"values": [
12,
87,
3,
45,
60
]
}
}
POST/v1/math/probability1 credit / call
Probability calculations
Compute a single-event probability from favorable/total outcomes, or combine two independent probabilities with AND/OR.
| Parameter | Type | Required | Description |
|---|
| mode | string | No | single | combine. Default: single. |
| favorable | number | No | mode=single: favorable outcomes. |
| total | number | No | mode=single: total outcomes. |
| first | number | No | mode=combine: first probability (0-1). |
| second | number | No | mode=combine: second probability (0-1). |
| operation | string | No | mode=combine: and | or. Default: and. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/probability \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"mode":"single","favorable":1,"total":6}'
Response
{
"ok": true,
"data": {
"probability": 0.1667,
"percentage": 16.67
}
}
POST/v1/math/combinatorics1 credit / call
Permutations and combinations
Compute nPr (permutations) and nCr (combinations) for n items choosing r.
| Parameter | Type | Required | Description |
|---|
| n | number | Yes | Total items. |
| r | number | Yes | Items chosen (0 <= r <= n). |
Request
curl -X POST https://toolsonduty.com/api/v1/math/combinatorics \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"n":5,"r":2}'
Response
{
"ok": true,
"data": {
"permutations": 20,
"combinations": 10
}
}
POST/v1/math/pythagorean1 credit / call
Right-triangle solver
Solve for the missing side, area and perimeter of a right triangle given two known sides.
| Parameter | Type | Required | Description |
|---|
| firstSide | number | Yes | First known side. |
| secondSide | number | Yes | Second known side (or hypotenuse when mode=leg). |
| mode | string | No | hypotenuse | leg. Default: hypotenuse. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/pythagorean \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"firstSide":3,"secondSide":4}'
Response
{
"ok": true,
"data": {
"missingSide": 5,
"area": 6,
"perimeter": 12
}
}
POST/v1/math/logarithm1 credit / call
Logarithm calculator
Compute a custom-base logarithm along with the natural (ln) and common (log10) logarithm.
| Parameter | Type | Required | Description |
|---|
| argument | number | Yes | Value to take the logarithm of (must be > 0). |
| base | number | Yes | Logarithm base (must be > 0 and not 1). |
Request
curl -X POST https://toolsonduty.com/api/v1/math/logarithm \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"argument":8,"base":2}'
Response
{
"ok": true,
"data": {
"value": 3,
"naturalLog": 2.079,
"commonLog": 0.903
}
}
POST/v1/math/fibonacci1 credit / call
Fibonacci generator
Generate a bounded Fibonacci-style safe-integer sequence.
| Parameter | Type | Required | Description |
|---|
| count | number | Yes | Number of values from 1 to 1,000. |
| first | number | No | First integer. Default: 0. |
| second | number | No | Second integer. Default: 1. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/fibonacci \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"count":8}'
Response
{
"ok": true,
"data": {
"values": [
0,
1,
1,
2,
3,
5,
8,
13
]
}
}
POST/v1/math/truth-table1 credit / call
Truth table generator
Generate a Boolean truth table for !, &&, ||, ^ and parentheses with up to eight variables.
| Parameter | Type | Required | Description |
|---|
| expression | string | Yes | Boolean expression, e.g. (A && B) || !C. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/truth-table \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"expression":"A && B"}'
Response
{
"ok": true,
"data": {
"expression": "A && B",
"variables": [
"A",
"B"
],
"rows": [
{
"values": {
"A": false,
"B": false
},
"result": false
}
]
}
}
POST/v1/math/roman1 credit / call
Roman numeral math
Add, subtract, multiply or divide canonical Roman numerals with results from 1 to 3999.
| Parameter | Type | Required | Description |
|---|
| first | string | Yes | First Roman numeral. |
| operator | string | Yes | + | - | * | /. |
| second | string | Yes | Second Roman numeral. |
Request
curl -X POST https://toolsonduty.com/api/v1/math/roman \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{"first":"XIV","operator":"+","second":"IX"}'
Response
{
"ok": true,
"data": {
"first": 14,
"second": 9,
"result": 23,
"roman": "XXIII"
}
}