@decidables/discountable-math
v0.1.7
Published
discountable-math: Equations for calculating Hyperbolic Temporal Discounting
Downloads
10
Maintainers
Readme
@decidables/discountable-math
Equations for Calculating Hyperbolic Temporal Discounting in diskountable
Helper functions for calculations related to Hyperbolic Temporal Discounting for diskountable.
Usage
Install
yarn add @decidables/discountable-math
Use
import CPTMath from '@decidables/discountable-math';
A class providing static functions for calculating Hyperbolic Temporal Discounting equations
Contents
HTDMath
Single class exposing static functions for HTD calculations. Each function takes values for one or
more variables and returns the value of another variable. The functions are named with a list of the
input variables followed by a '2' followed by the output variable, in camelcase. For example,
adk2v
takes as input the amount, a
, the delay, d
, and a discounting factor, k
, and outputs
the value, v
.
Variable names
- a = objective amount
- d = delay
- v = subjective value
- k = discounting factor
Methods w/implemented equations
adk2v(a, d, k)
- v = a / (1 + k * d)
adv2k(a, d, v)
- k = (a - v) / (v * d)
Development
Features/Bugs/Notes
Package Scripts
yarn lint
- Lints markdown, scripts and styles
yarn test
- Runs all tests and reports coverage in
test/coverage/
- Runs all tests and reports coverage in
yarn test:watch
- Runs all tests in watch mode and reports coverage in
test/coverage/
- Runs all tests in watch mode and reports coverage in
yarn test:file <filename>
- Runs tests for a single file and reports coverage in
test/coverage/
- Runs tests for a single file and reports coverage in
yarn build
- Builds bundles from
src/
tolib/
- Builds bundles from
File Organization
discountable-math/
lib/
(Bundles created fromsrc/
bybuild
) [autogenerated]src/
(Source files)test/
(Testing files)coverage/
(Code coverage results) [autogenerated]
CHANGELOG.md
(Based on conventional commits) [autogenerated]gulpfile.js
(Tasks for gulp)package.json
(Package config for yarn and npm)README.md
(This file)rollup-stats.html
(Report on js bundle composition and size) [autogenerated]
License
The content of this project is licensed under Creative Commons Attribution-ShareAlike 4.0 International License (CC-BY-SA-4.0) and the source code of this project is licensed under GNU General Public License v3.0 or any later version (GPL-3.0-or-later).