README.md (3123B)
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 # beta 22 23 > [Beta function][beta-function]. 24 25 <section class="intro"> 26 27 The [beta function][beta-function], also called the Euler integral, is defined as 28 29 <!-- <equation class="equation" label="eq:beta_function" align="center" raw="\operatorname{Beta}(x,y) = \int_0^1t^{x-1}(1-t)^{y-1}\,\mathrm{d}t" alt="Equation for the beta function."> --> 30 31 <div class="equation" align="center" data-raw-text="\operatorname{Beta}(x,y) = \int_0^1t^{x-1}(1-t)^{y-1}\,\mathrm{d}t" data-equation="eq:beta_function"> 32 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/beta/docs/img/equation_beta_function.svg" alt="Equation for the beta function."> 33 <br> 34 </div> 35 36 <!-- </equation> --> 37 38 The [beta function][beta-function] is related to the [Gamma function][gamma-function] via the following equation 39 40 <!-- <equation class="equation" label="eq:beta_function2" align="center" raw="\operatorname{Beta}(x,y)=\dfrac{\Gamma(x)\,\Gamma(y)}{\Gamma(x+y)} \!" alt="Beta function expressed in terms of the Gamma function."> --> 41 42 <div class="equation" align="center" data-raw-text="\operatorname{Beta}(x,y)=\dfrac{\Gamma(x)\,\Gamma(y)}{\Gamma(x+y)} \!" data-equation="eq:beta_function2"> 43 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/beta/docs/img/equation_beta_function2.svg" alt="Beta function expressed in terms of the Gamma function."> 44 <br> 45 </div> 46 47 <!-- </equation> --> 48 49 </section> 50 51 <!-- /.intro --> 52 53 <section class="usage"> 54 55 ## Usage 56 57 ```javascript 58 var beta = require( '@stdlib/math/base/special/beta' ); 59 ``` 60 61 #### beta( x, y ) 62 63 Evaluates the [beta function][beta-function]. 64 65 ```javascript 66 var val = beta( 0.0, 0.5 ); 67 // returns Infinity 68 69 val = beta( 1.0, 1.0 ); 70 // returns 1.0 71 72 val = beta( -1.0, 2.0 ); 73 // returns NaN 74 75 val = beta( 5.0, 0.2 ); 76 // returns ~3.382 77 78 val = beta( 4.0, 1.0 ); 79 // returns 0.25 80 ``` 81 82 </section> 83 84 <!-- /.usage --> 85 86 <section class="examples"> 87 88 ## Examples 89 90 <!-- eslint no-undef: "error" --> 91 92 ```javascript 93 var beta = require( '@stdlib/math/base/special/beta' ); 94 var x; 95 var y; 96 97 for ( x = 0; x < 10; x++ ) { 98 for ( y = 10; y > 0; y-- ) { 99 console.log( 'x: %d, \t y: %d, \t f(x,y): %d', x, y, beta( x, y ) ); 100 } 101 } 102 ``` 103 104 </section> 105 106 <!-- /.examples --> 107 108 <section class="links"> 109 110 [beta-function]: http://en.wikipedia.org/wiki/Beta_function 111 112 [gamma-function]: https://en.wikipedia.org/wiki/Gamma_function 113 114 </section> 115 116 <!-- /.links -->