README.md (3207B)
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 # Dirac Delta 22 23 > Evaluate the [Dirac delta function][dirac-delta-function]. 24 25 <section class="intro"> 26 27 The [Dirac delta function][dirac-delta-function] may be loosely defined as 28 29 <!-- <equation class="equation" label="eq:dirac_delta" align="center" raw="\delta = \begin{cases} \infty & \textrm{if}\ x = 0 \\ 0 & \textrm{if}\ x \neq 0\end{cases}" alt="Dirac delta function."> --> 30 31 <div class="equation" align="center" data-raw-text="\delta = \begin{cases} \infty & \textrm{if}\ x = 0 \\ 0 & \textrm{if}\ x \neq 0\end{cases}" data-equation="eq:dirac_delta"> 32 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/dirac-delta/docs/img/equation_dirac_delta.svg" alt="Dirac delta function."> 33 <br> 34 </div> 35 36 <!-- </equation> --> 37 38 and is constrained to satisfy the identity 39 40 <!-- <equation class="equation" label="eq:dirac_delta_integral" align="center" raw="\int^{+\infty}_{-\infty} \delta(x)\ dx = 1" alt="Dirac delta function integral."> --> 41 42 <div class="equation" align="center" data-raw-text="\int^{+\infty}_{-\infty} \delta(x)\ dx = 1" data-equation="eq:dirac_delta_integral"> 43 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/dirac-delta/docs/img/equation_dirac_delta_integral.svg" alt="Dirac delta function integral."> 44 <br> 45 </div> 46 47 <!-- </equation> --> 48 49 Note that the [Dirac delta function][dirac-delta-function] is **not** a function in the traditional sense, as any real-valued function which is zero everywhere except at a single point, must have an integral equal to `0`. 50 51 </section> 52 53 <!-- /.intro --> 54 55 <section class="usage"> 56 57 ## Usage 58 59 ```javascript 60 var diracDelta = require( '@stdlib/math/base/special/dirac-delta' ); 61 ``` 62 63 #### diracDelta( x ) 64 65 Evaluates the [Dirac delta function][dirac-delta-function]. 66 67 ```javascript 68 var v = diracDelta( 0.0 ); 69 // returns Infinity 70 71 v = diracDelta( 3.14 ); 72 // returns 0.0 73 74 v = diracDelta( NaN ); 75 // returns NaN 76 ``` 77 78 </section> 79 80 <!-- /.usage --> 81 82 <section class="examples"> 83 84 ## Examples 85 86 <!-- eslint no-undef: "error" --> 87 88 ```javascript 89 var linspace = require( '@stdlib/array/linspace' ); 90 var diracDelta = require( '@stdlib/math/base/special/dirac-delta' ); 91 92 var x = linspace( -1.0, 1.0, 101 ); 93 var i; 94 95 for ( i = 0; i < x.length; i++ ) { 96 console.log( 'dirac(%d) = %d', x[ i ], diracDelta( x[ i ] ) ); 97 } 98 ``` 99 100 </section> 101 102 <!-- /.examples --> 103 104 <section class="links"> 105 106 [dirac-delta-function]: https://en.wikipedia.org/wiki/Dirac_delta_function 107 108 </section> 109 110 <!-- /.links -->