Computes the harmonic mean of numerical datasets, useful for averaging rates, ratios, and percentages. Access via MCP in AI coding assistants or REST API at `/v1/stats/harmonic-mean`. Returns precise calculations where arithmetic mean would be misleading — like average speeds or financial ratios. Handles edge cases like zeros and negative values appropriately.
curl "https://tinyfn.io/v1/stats/harmonic-mean" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/harmonic-mean', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/stats/harmonic-mean',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's statistics tools:
{
"mcpServers": {
"tinyfn-stats": {
"url": "https://tinyfn.io/mcp/stats",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Harmonic mean is the reciprocal of the arithmetic mean of reciprocals, ideal for averaging rates, speeds, or ratios. Use it when values represent rates (like mph, fps) or when you need the average that preserves proportional relationships.
The tool returns an error for datasets containing zeros (division by zero) or negative numbers (undefined for harmonic mean). Filter your data before calling or use arithmetic/geometric means for mixed-sign datasets.
Yes, send arrays via POST request to handle large datasets that exceed URL length limits. The endpoint processes thousands of values efficiently while maintaining numerical precision.
Harmonic mean best represents average rates (requests/sec, throughput), arithmetic mean for simple averages, geometric mean for growth rates. Harmonic mean is always ≤ geometric mean ≤ arithmetic mean.
Use MCP to call the harmonic mean function directly in your analysis. Perfect for calculating average response times, throughput rates, or any performance metrics where extreme values shouldn't dominate the result.
Get your free API key and start using Harmonic Mean in seconds.
Get Free API Key