Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/basementuniverse/weighted-averages

Various weighted average functions
https://github.com/basementuniverse/weighted-averages

Last synced: 23 days ago
JSON representation

Various weighted average functions

Awesome Lists containing this project

README

        

# Weighted averages

Various weighted average functions.

## Installation

```
npm install -g @basementuniverse/weighted-averages
```

## Usage

```ts
import {
weightedArithmeticMean,
weightedGeometricMean,
inverseWeightedGeometricMean,
weightedHarmonicMean,
inverseWeightedHarmonicMean,
} from '@basementuniverse/weighted-averages';

console.log(weightedArithmeticMean([1, 2, 3], [1, 1, 1]));
console.log(weightedGeometricMean([1, 2, 3], [1, 1, 1]));
console.log(inverseWeightedGeometricMean([1, 2, 3], [1, 1, 1]));
console.log(weightedHarmonicMean([1, 2, 3], [1, 1, 1]));
console.log(inverseWeightedHarmonicMean([1, 2, 3], [1, 1, 1]));
```

See `demo.html` for a browser-based demo.