time-to-botec

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

README.md (2506B)


      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 # fresnelc
     22 
     23 > Compute the [Fresnel integral][fresnel-integral] C(x).
     24 
     25 <section class="intro">
     26 
     27 The [Fresnel integral][fresnel-integral] C(x) is defined as
     28 
     29 <!-- <equation class="equation" label="eq:fresnel_integral" align="center" raw="C(x) = \int_0^x \cos\left(\frac{\pi}{2} t^2\right)\,\mathrm{d}t." alt="Fresnel integral C(x)"> -->
     30 
     31 <div class="equation" align="center" data-raw-text="C(x) = \int_0^x \cos\left(\frac{\pi}{2} t^2\right)\,\mathrm{d}t." data-equation="eq:fresnel_integral">
     32     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@591cf9d5c3a0cd3c1ceec961e5c49d73a68374cb/lib/node_modules/@stdlib/math/base/special/fresnelc/docs/img/equation_fresnel_integral.svg" alt="Fresnel integral C(x)">
     33     <br>
     34 </div>
     35 
     36 <!-- </equation> -->
     37 
     38 Some sources define C(x) using t<sup>2</sup> for the argument of the cosine. To get this function, multiply the computed integral by `√(π/2)` and multiply the argument `x` by `√(2/π)`.
     39 
     40 </section>
     41 
     42 <!-- /.intro -->
     43 
     44 <section class="usage">
     45 
     46 ## Usage
     47 
     48 ```javascript
     49 var fresnelc = require( '@stdlib/math/base/special/fresnelc' );
     50 ```
     51 
     52 #### fresnelc( x )
     53 
     54 Computes the [Fresnel integral][fresnel-integral] C(x).
     55 
     56 ```javascript
     57 var v = fresnelc( 0.0 );
     58 // returns ~0.0
     59 
     60 v = fresnelc( 1.0 );
     61 // returns ~0.780
     62 
     63 v = fresnelc( Infinity );
     64 // returns ~0.5
     65 
     66 v = fresnelc( -Infinity );
     67 // returns ~-0.5
     68 
     69 v = fresnelc( NaN );
     70 // returns NaN
     71 ```
     72 
     73 </section>
     74 
     75 <!-- /.usage -->
     76 
     77 <section class="examples">
     78 
     79 ## Examples
     80 
     81 <!-- eslint no-undef: "error" -->
     82 
     83 ```javascript
     84 var linspace = require( '@stdlib/array/linspace' );
     85 var fresnelc = require( '@stdlib/math/base/special/fresnelc' );
     86 
     87 var x = linspace( 0.0, 10.0, 100 );
     88 var i;
     89 
     90 for ( i = 0; i < x.length; i++ ) {
     91     console.log( fresnelc( x[ i ] ) );
     92 }
     93 ```
     94 
     95 </section>
     96 
     97 <!-- /.examples -->
     98 
     99 <section class="links">
    100 
    101 [fresnel-integral]: https://en.wikipedia.org/wiki/Fresnel_integral
    102 
    103 </section>
    104 
    105 <!-- /.links -->