{"name":"mathfn","description":"Some basic but difficult to implement mathmatical functions","version":"0.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"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","engines":{"node":"0.10","npm":"1"},"bugs":{"url":"https://github.com/AndreasMadsen/mathfn/issues"},"_id":"mathfn@0.2.0","dist":{"shasum":"701738295dd1a0514d134660765541bf7f96a5d2","tarball":"http://registry-npm.ywwl.com/mathfn/download/mathfn-0.2.0.tgz","integrity":"sha512-/YscuBmqgdaJBhxbyLPp4esERaofnml6dATfSct0OJXFPmbFIZBQLqATEOE1nf/C2bnwy+pWa+gzLeZ8mJtbfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAYrU+WzlqY7aSkKFhjdvZHWDoIU1CKC0nsV0aK1g4AfAiAhy4AYe5Rs0Ch84DJzuE83jTtFyxdNgKe+m3DjEUIMKw=="}],"size":5894,"noattachment":false,"key":"/mathfn/-/mathfn-0.2.0.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{},"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":1372533309547,"_cnpm_publish_time":1372533309547,"dist-tags":{"latest":"1.2.0"}}