Created
November 6, 2017 17:25
-
-
Save jwalsh/9c0a8a167307e85f26aecf50be528111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let mock = (roi, months = 6) => { | |
| console.log('month, value, error1, error2'); | |
| let l = v => { | |
| let growth = { | |
| exp: Math.exp(v, 2), | |
| nlogn: v * Math.log(v), | |
| linear: v | |
| }; | |
| let result = growth['exp']; | |
| return result; | |
| }; | |
| // the forcing weight at the end of the month | |
| let f = l(months + 1); | |
| let cols = (new Array(months + 1)) | |
| .fill(null) | |
| .map((e, i) => { | |
| let m = i + 1; | |
| let name = i === 0 ? 'start' : `m${i}`; | |
| let target = Math.ceil(l(m) * roi / f); | |
| let error1 = Math.ceil(target * .5); | |
| let error2 = Math.ceil(target * .8); | |
| console.log([name, target, error1, error2].join(',')); | |
| }); | |
| }; | |
| mock(10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment