time-to-botec

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

README.md (3715B)


      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 # Physicist's Hermite Polynomial
     22 
     23 > Evaluate a physicist's [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 physicist's [Hermite polynomials][hermite-polynomial] are given by
     30 
     31 <!-- <equation class="equation" label="eq:physicists_hermite_polynomials" align="center" raw="H_{n}(x)=(-1)^{n} e^{x^2} \frac{\mathrm{d}^{n}}{\mathrm{d} x^{n}} e^{-x^2}" alt="Equation for physicist's Hermite polynomials."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="H_{n}(x)=(-1)^{n} e^{x^2} \frac{\mathrm{d}^{n}}{\mathrm{d}x^n} e^{-x^2}" data-equation="eq:physicists_hermite_polynomials">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@58b02120eb58818177f6767ab495e7afac3618e8/lib/node_modules/@stdlib/math/base/tools/hermitepoly/docs/img/equation_physicists_hermite_polynomials.svg" alt="Equation for physicist's 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 hermitepoly = require( '@stdlib/math/base/tools/hermitepoly' );
     52 ```
     53 
     54 #### hermitepoly( n, x )
     55 
     56 Evaluates a physicist's [Hermite polynomial][hermite-polynomial] of degree `n`.
     57 
     58 ```javascript
     59 var v = hermitepoly( 1, 1.0 );
     60 // returns 2.0
     61 
     62 v = hermitepoly( 1, 0.5 );
     63 // returns ~1.0
     64 
     65 v = hermitepoly( -1, 0.5 );
     66 // returns NaN
     67 
     68 v = hermitepoly( 0, 0.5 );
     69 // returns 1.0
     70 
     71 v = hermitepoly( 2, 0.5 );
     72 // returns -1.0
     73 ```
     74 
     75 #### hermitepoly.factory( n )
     76 
     77 Returns a `function` for evaluating a physicist's [Hermite polynomial][hermite-polynomial] of degree `n`.
     78 
     79 ```javascript
     80 var polyval = hermitepoly.factory( 2 );
     81 
     82 var v = polyval( 0.5 );
     83 // returns -1.0
     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 hermitepoly = require( '@stdlib/math/base/tools/hermitepoly' );
    109 
    110 var x;
    111 var y;
    112 var i;
    113 var j;
    114 
    115 for ( i = 0; i < 100; i++ ) {
    116     x = (randu()*100.0) - 50.0;
    117     for ( j = 1; j < 3; j++ ) {
    118         y = hermitepoly( j, x );
    119         console.log( 'H_%d( %d ) = %d', j, x.toFixed( 3 ), y.toFixed( 3 ) );
    120     }
    121 }
    122 ```
    123 
    124 </section>
    125 
    126 <!-- /.examples -->
    127 
    128 <!-- 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. -->
    129 
    130 <section class="references">
    131 
    132 </section>
    133 
    134 <!-- /.references -->
    135 
    136 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    137 
    138 <section class="links">
    139 
    140 [hermite-polynomial]: https://en.wikipedia.org/wiki/Hermite_polynomials
    141 
    142 </section>
    143 
    144 <!-- /.links -->