README.md (1968B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # gammaln 22 23 > [Natural logarithm][@stdlib/math/base/special/ln] of the [gamma][@stdlib/math/base/special/gamma] function. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var gammaln = require( '@stdlib/math/base/special/gammaln' ); 31 ``` 32 33 #### gammaln( x ) 34 35 Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma]. 36 37 ```javascript 38 var v = gammaln( 2.0 ); 39 // returns 0.0 40 41 v = gammaln( 1.0 ); 42 // returns 0.0 43 44 v = gammaln( 4.0 ); 45 // returns ~1.792 46 47 v = gammaln( -0.5 ); 48 // returns ~1.266 49 50 v = gammaln( 0.5 ); 51 // returns ~0.572 52 53 v = gammaln( 0.0 ); 54 // returns Infinity 55 56 v = gammaln( NaN ); 57 // returns NaN 58 ``` 59 60 </section> 61 62 <!-- /.usage --> 63 64 <section class="examples"> 65 66 ## Examples 67 68 <!-- eslint no-undef: "error" --> 69 70 ```javascript 71 var linspace = require( '@stdlib/array/linspace' ); 72 var gammaln = require( '@stdlib/math/base/special/gammaln' ); 73 74 var x = linspace( -10.0, 10.0, 100 ); 75 var v; 76 var i; 77 78 for ( i = 0; i < x.length; i++ ) { 79 v = gammaln( x[ i ] ); 80 console.log( 'x: %d, f(x): %d', x[ i ], v ); 81 } 82 ``` 83 84 </section> 85 86 <!-- /.examples --> 87 88 <section class="links"> 89 90 [@stdlib/math/base/special/gamma]: https://www.npmjs.com/package/@stdlib/math/tree/main/base/special/gamma 91 92 [@stdlib/math/base/special/ln]: https://www.npmjs.com/package/@stdlib/math/tree/main/base/special/ln 93 94 </section> 95 96 <!-- /.links -->