{"name":"mathfn","description":"Some basic but difficult to implement mathmatical functions","version":"1.2.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./mathfn.js","scripts":{"test":"tap test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/mathfn.git"},"keywords":["math","erf","gamma","beta","log"],"devDependencies":{"tap":"^12.1.0"},"license":"MIT","gitHead":"620627c39ab317de0b813277fc7ea38ff53b1f81","bugs":{"url":"https://github.com/AndreasMadsen/mathfn/issues"},"homepage":"https://github.com/AndreasMadsen/mathfn#readme","_id":"mathfn@1.2.0","_nodeVersion":"15.1.0","_npmVersion":"7.0.8","dist":{"integrity":"sha512-QBcepxkFxuGk12q4G0KuNbuU3UCXhDROxWZllaNZSpBivkHl2z8qNvi7UGE/WLJt+c7GTC4jigYtur+JDL+40A==","shasum":"0e952bd7a8b66e39f490ace4642e675b5837c83e","tarball":"http://registry-npm.ywwl.com/mathfn/download/mathfn-1.2.0.tgz","fileCount":13,"unpackedSize":31525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGEVACRA9TVsSAnZWagAAbd0P/iPxcfr5knkhCC0YOWTF\nXaWNFj21bDtZmxGVMFWl8l+6eYypLHN/G4e0ui9IR9F6pdcGQOTSP9N8XQoQ\n+Vlru2els9hatnu3c0PDXNlnXwBdY2MkS9jxAekrKNKquv1UDhg6K5gw+W6u\nYsyP4bVVxFJaEP5RGOGHoT/rUaIds6OzSmy0Uuw0xG5/fkMToo2UVxU/0+KT\nhoaftn0tOXhEiDlpDcYSj2Ft7W5VFU9kLl7g+NyaESmKM0fS6zkLY0aIWttA\nCJtizgC2aFI/h/F9z1QVJhjHc9c5zdfdf+lKtKStUM6T4dNXRn30yL1SaGqW\nwqdSXpecb1NueWjN953v6FgI3Db51bSdNsKS3vjCUBDSMyMkPJfF5ElyoCNw\ns+PlZwFdQWvTrsjke9aNmVaznmhFDPBJ9MO1HVCG09eN0CNEoMJLpqygEmZV\njexdacgp15PZEugwUM6S+raOW9lcXT9OIsNziHDbKqCS/6D4FjF6sm/mGYsz\nEW9G2Dd/rUPkAsnxGhA8Zp61wCfDYzQ5bfHhL7tSg6CL8vG7GqwCWGSUerBG\nasXjLbR0Wu2wP7wp74DsiQAK+6US/eYeL/RGRnL9B0qn49MSv8SHltUywXqx\nhgcYrrJpmJ6aRGsC/ecx6M0yMz9niR2RzI+zZBLfdg3HM6WbAaMDrO0TEDS3\ncrjL\r\n=Ivhq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAUqpbwRy7hCYBhIZ9Gi/WYlCBHHbe3AH0c9ry4Sc+++AiEAxw6RBd0Ks9aLCsxxRpEQTb6V1Zow8m5o3xwJPgV2E2U="}],"size":12382,"noattachment":false,"key":"/mathfn/-/mathfn-1.2.0.tgz"},"_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"directories":{},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mathfn_1.2.0_1612203328279_0.6713265583680184"},"_hasShrinkwrap":false,"deprecated":"Use cephes instead, for a more complete and well-tested module","readme":"# mathfn\n\n> Some basic but difficult to implement mathmatical functions<br>\n> _Note: for distribution functions please see [`distributions`](https://github.com/AndreasMadsen/distributions)_\n\n## Installation\n\n```sheel\nnpm install mathfn\n```\n\n## Example\n\n```javascript\nvar mathfn = require('mathfn');\n\nconsole.log(mathfn.erf(0)); // 0.0\n```\n\n## Documentation\n\n`mathfn` is a slowly growing collection of some difficult mathmatical functions\nthere should be included in `Math.` but isn't. This is a list of the currently\nimplemented functions and a few details.\n\n### Error functions\n\n##### `p = erf(x)` - The error function\n\nThis function is implemented using the \"Abramowitz & Stegun\" approximation\nits theortical accuracy is `1.5 * 10^-7`. However the limitations of JavaScript\nmight result in a lower accuracy.\n\n##### `p = erfc(x)` The complementary error function\n\nUnlike most implementation of `erfc(x)`, this is not calculated using `1 - erf(x)`,\nbut is an acutall approximation of `erfc(x)`.\n\n##### `p = invErf(p)` The inverse error function\n\nThis is calculated using `inverf(p) = -inverfc(p + 1)`, if you known of specific\napproximation please file an issue or pull request.\n\n##### `p = invErfc(p)` The inverse complementary error function\n\nThis uses a very common approximation of `inverfc(p)`, see source code for more\ndetails.\n\n### Gamma functions\n\n##### `p = gamma(x)` The gamma function\n\nThis acutally contains 3 diffrent approximations of `gamma(x)` which one is\nautomatically determined by the `x` value.\n\n##### `p = logGamma(x)` The logarithmic gamma function\n\nFor values less than `12` the result is calculated using `log(gamma(x))`, in\nany other case a specific approximation is used.\n\n### Beta functions\n\nThese are taken from the `jstat` library and modified to fit intro the API\npattern used in this module. Futhermore they also take advanges of the special\n`log1p` function implemented in this module.\n\n##### `p = beta(x, y)` - The beta function\n\n##### `p = logBeta(x, y)` - The logarithmic beta function\n\n##### `p = incBeta(x, a, b)` - The incomplete beta function\n\n##### `p = invIncBeta(p, a, b)` - The inverse incomplete beta function\n\n### Logarithmic functions\n\n##### `y = log1p(x)` - Calculates `y = ln(1 + x)`\n\nWhen `x` is a very small number computers calculates `ln(1 + x)` as `ln(1)` which\nis `zero` and then every thing is lost. This is a specific approximation of\n`ln(1 + x)` and should be used only in case of small values.\n\n##### `y = logFactorial(x)` - Calculates `y = ln(x!)`\n\n`x!` can quickly get very big, and exceed the limitation of the float value,\napproimating `ln(x!)` instead can in some cases solve this problem.\n\n## Testing\n\nAll functions are tested by comparing with a mathematical reference\neither _MatLab_, _Maple_ or _R_.\n\n## Thanks\n\nA special thank to John D. Cook, who writes a very good blog about some of these\nfunctions, and maintains a [stand alone implementation catalog](http://www.johndcook.com/stand_alone_code.html).\nSee also this article about regarding floating point errors in some mathematical\nfunction: http://www.johndcook.com/blog/2010/06/07/math-library-functions-that-seem-unnecessary/\n\n## License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2013 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","publish_time":1612203328582,"_cnpm_publish_time":1612203328582,"dist-tags":{"latest":"1.2.0"}}