README.md (1750B)
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 # log1mexp 22 23 > Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1-exp(-|x|)`. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var log1mexp = require( '@stdlib/math/base/special/log1mexp' ); 31 ``` 32 33 #### log1mexp( x ) 34 35 Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1-exp(-|x|)`. 36 37 ```javascript 38 var y = log1mexp( 0.0 ); 39 // returns -Infinity 40 41 y = log1mexp( 5.0 ); 42 // returns ~-0.00676 43 44 y = log1mexp( 10.0 ); 45 // returns ~-0.00005 46 47 y = log1mexp( -10.0 ); 48 // returns ~-0.00005 49 50 y = log1mexp( NaN ); 51 // returns NaN 52 ``` 53 54 </section> 55 56 <!-- /.usage --> 57 58 <section class="examples"> 59 60 ## Examples 61 62 <!-- eslint no-undef: "error" --> 63 64 ```javascript 65 var incrspace = require( '@stdlib/array/incrspace' ); 66 var log1mexp = require( '@stdlib/math/base/special/log1mexp' ); 67 68 var x = incrspace( -10.0, 10.0, 0.01 ); 69 var v; 70 var i; 71 72 for ( i = 0; i < x.length; i++ ) { 73 v = log1mexp( x[ i ] ); 74 console.log( 'x: %d, f(x): %d', x[ i ], v ); 75 } 76 ``` 77 78 </section> 79 80 <!-- /.examples --> 81 82 <section class="links"> 83 84 [@stdlib/math/base/special/ln]: https://www.npmjs.com/package/@stdlib/math/tree/main/base/special/ln 85 86 </section> 87 88 <!-- /.links -->