Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshuaclayton/moving-averages
https://github.com/joshuaclayton/moving-averages
haskell mathematics moving-average
Last synced: about 3 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/joshuaclayton/moving-averages
- Owner: joshuaclayton
- License: mit
- Created: 2017-05-04T23:26:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-12T22:45:00.000Z (over 7 years ago)
- Last Synced: 2024-02-21T10:22:02.151Z (9 months ago)
- Topics: haskell, mathematics, moving-average
- Language: Haskell
- Size: 26.4 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# moving-averages
This is a library for calculating moving averages on lists of numbers.
## Usage
```haskell
import qualified Data.MovingAverage as MAresultValues :: Floating a => MA.SmoothedResults a -> [a]
resultValues = map MA.srSmoothedValue . MA.srsResults-- window of 2
resultValues <$> MA.simple 2 [5, 10, 20, 2]
-- Right [5.0, 7.5, 15.0, 11.0]-- alpha of 0.5
resultValues <$> MA.singleExponential 0.5 [1, 2, 3, 4, 5]
-- Right [1, 1.5, 2.25, 3.125, 4.0625]-- alpha of 0.5, beta of 0.1
resultValues <$> MA.doubleExponential 0.5 0.1 [3, 1, 4, 6, 8]
-- Right [3.0, 1.0, 1.5, 2.875, 4.71875]
```## License
Copyright 2017 Josh Clayton. See the [LICENSE](LICENSE).