time-to-botec

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

README.md (3872B)


      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 # Normalized Hermite Polynomial
     22 
     23 > Evaluate a normalized [Hermite polynomial][hermite-polynomial].
     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 normalized (aka "probabilist") [Hermite polynomials][hermite-polynomial] are given by
     30 
     31 <!-- <equation class="equation" label="eq:normalized_hermite_polynomials" align="center" raw="He_{n}(x)=(-1)^{n} e^{\frac{x^2}{2}} \frac{\mathrm d^{n}}{\mathrm d x^{n}} e^{-\frac{x^2}{2}}" alt="Equation for normalized Hermite polynomials."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="He_{n}(x)=(-1)^{n} e^{\frac{x^2}{2}} \frac{\mathrm{d}^{n}}{\mathrm{d}x^n} e^{-\frac{x^2}{2}}" data-equation="eq:normalized_hermite_polynomials">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bea0101eb61892f160eec8d97dc79188fd937523/lib/node_modules/@stdlib/math/base/tools/normhermitepoly/docs/img/equation_normalized_hermite_polynomials.svg" alt="Equation for normalized Hermite polynomials.">
     35     <br>
     36 </div>
     37 
     38 <!-- </equation> -->
     39 
     40 </section>
     41 
     42 <!-- /.intro -->
     43 
     44 <!-- Package usage documentation. -->
     45 
     46 <section class="usage">
     47 
     48 ## Usage
     49 
     50 ```javascript
     51 var normhermitepoly = require( '@stdlib/math/base/tools/normhermitepoly' );
     52 ```
     53 
     54 #### normhermitepoly( n, x )
     55 
     56 Evaluates a normalized [Hermite polynomial][hermite-polynomial] of degree `n`.
     57 
     58 ```javascript
     59 var v = normhermitepoly( 1, 1.0 );
     60 // returns 1.0
     61 
     62 v = normhermitepoly( 1, 0.5 );
     63 // returns 0.5
     64 
     65 v = normhermitepoly( 0, 0.5 );
     66 // returns 1.0
     67 
     68 v = normhermitepoly( 2, 0.5 );
     69 // returns -0.75
     70 
     71 v = normhermitepoly( -1, 0.5 );
     72 // returns NaN
     73 ```
     74 
     75 #### normhermitepoly.factory( n )
     76 
     77 Returns a `function` for evaluating a normalized [Hermite polynomial][hermite-polynomial] of degree `n`.
     78 
     79 ```javascript
     80 var polyval = normhermitepoly.factory( 2 );
     81 
     82 var v = polyval( 0.5 );
     83 // returns -0.75
     84 ```
     85 
     86 </section>
     87 
     88 <!-- /.usage -->
     89 
     90 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     91 
     92 <section class="notes">
     93 
     94 </section>
     95 
     96 <!-- /.notes -->
     97 
     98 <!-- Package usage examples. -->
     99 
    100 <section class="examples">
    101 
    102 ## Examples
    103 
    104 <!-- eslint no-undef: "error" -->
    105 
    106 ```javascript
    107 var randu = require( '@stdlib/random/base/randu');
    108 var normhermitepoly = require( '@stdlib/math/base/tools/normhermitepoly' );
    109 
    110 var xx;
    111 var yy;
    112 var x;
    113 var y;
    114 var i;
    115 var j;
    116 
    117 for ( i = 0; i < 100; i++ ) {
    118     x = (randu()*100.0) - 50.0;
    119     for ( j = 1; j < 3; j++ ) {
    120         y = normhermitepoly( j, x );
    121         xx = x.toFixed(3);
    122         yy = y.toFixed(3);
    123         console.log( 'He_%d( %d ) = %d', j, xx, yy );
    124     }
    125 }
    126 ```
    127 
    128 </section>
    129 
    130 <!-- /.examples -->
    131 
    132 <!-- 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. -->
    133 
    134 <section class="references">
    135 
    136 </section>
    137 
    138 <!-- /.references -->
    139 
    140 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    141 
    142 <section class="links">
    143 
    144 [hermite-polynomial]: https://en.wikipedia.org/wiki/Hermite_polynomials
    145 
    146 </section>
    147 
    148 <!-- /.links -->