time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (3398B)


      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 # Entropy
     22 
     23 > [Degenerate][degenerate-distribution] distribution [entropy][entropy].
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 The [entropy][entropy] (in [nats][nats]) for a [degenerate][degenerate-distribution] random variable is
     30 
     31 <!-- <equation class="equation" label="eq:degenerate_entropy" align="center" raw="H\left( X \right) = 0" alt="Entropy for a degenerate distribution."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="H\left( X \right) = 0" data-equation="eq:degenerate_entropy">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@e1fbdee688c5409e4cc6b0cd06d90b1cd2abd67c/lib/node_modules/@stdlib/stats/base/dists/degenerate/entropy/docs/img/equation_degenerate_entropy.svg" alt="Entropy for a degenerate distribution.">
     35     <br>
     36 </div>
     37 
     38 <!-- </equation> -->
     39 
     40 where `μ` is the constant value of the distribution.
     41 
     42 </section>
     43 
     44 <!-- /.intro -->
     45 
     46 <!-- Package usage documentation. -->
     47 
     48 <section class="usage">
     49 
     50 ## Usage
     51 
     52 ```javascript
     53 var entropy = require( '@stdlib/stats/base/dists/degenerate/entropy' );
     54 ```
     55 
     56 #### entropy( mu )
     57 
     58 Returns the [entropy][entropy] of a [degenerate][degenerate-distribution] distribution with constant value `mu`.
     59 
     60 ```javascript
     61 var v = entropy( 10.0 );
     62 // returns 0.0
     63 
     64 v = entropy( -0.5 );
     65 // returns 0.0
     66 
     67 v = entropy( NaN );
     68 // returns NaN
     69 ```
     70 
     71 </section>
     72 
     73 <!-- /.usage -->
     74 
     75 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     76 
     77 <section class="notes">
     78 
     79 </section>
     80 
     81 <!-- /.notes -->
     82 
     83 <!-- Package usage examples. -->
     84 
     85 <section class="examples">
     86 
     87 ## Examples
     88 
     89 <!-- eslint no-undef: "error" -->
     90 
     91 ```javascript
     92 var randu = require( '@stdlib/random/base/randu' );
     93 var entropy = require( '@stdlib/stats/base/dists/degenerate/entropy' );
     94 
     95 var mu;
     96 var v;
     97 var i;
     98 
     99 for ( i = 0; i < 10; i++ ) {
    100     mu = randu();
    101     v = entropy( mu );
    102     console.log( 'µ: %d, H(X;µ): %d', mu.toFixed( 4 ), v.toFixed( 4 ) );
    103 }
    104 ```
    105 
    106 </section>
    107 
    108 <!-- /.examples -->
    109 
    110 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    111 
    112 <section class="references">
    113 
    114 </section>
    115 
    116 <!-- /.references -->
    117 
    118 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    119 
    120 <section class="links">
    121 
    122 [degenerate-distribution]: https://en.wikipedia.org/wiki/Degenerate_distribution
    123 
    124 [entropy]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
    125 
    126 [nats]: https://en.wikipedia.org/wiki/Nat_%28unit%29
    127 
    128 </section>
    129 
    130 <!-- /.links -->