time-to-botec

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

README.md (2294B)


      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 # Havercosine
     22 
     23 > Compute the half-value [versed cosine][versed-cosine].
     24 
     25 <section class="intro">
     26 
     27 The half-value [versed cosine][versed-cosine] is defined as
     28 
     29 <!-- <equation class="equation" label="eq:havercosine" align="center" raw="\operatorname{havercos}(\theta) = \frac{1 + \cos \theta}{2}" alt="Haversed cosine."> -->
     30 
     31 <div class="equation" align="center" data-raw-text="\operatorname{havercos}(\theta) = \frac{1 + \cos \theta}{2}" data-equation="eq:havercosine">
     32     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/havercos/docs/img/equation_havercosine.svg" alt="Haversed cosine.">
     33     <br>
     34 </div>
     35 
     36 <!-- </equation> -->
     37 
     38 </section>
     39 
     40 <!-- /.intro -->
     41 
     42 <section class="usage">
     43 
     44 ## Usage
     45 
     46 ```javascript
     47 var havercos = require( '@stdlib/math/base/special/havercos' );
     48 ```
     49 
     50 #### havercos( x )
     51 
     52 Computes the half-value [versed cosine][versed-cosine] (in radians).
     53 
     54 ```javascript
     55 var v = havercos( 0.0 );
     56 // returns 1.0
     57 
     58 v = havercos( 3.141592653589793/2.0 );
     59 // returns 0.5
     60 
     61 v = havercos( -3.141592653589793/6.0 );
     62 // returns ~0.9330
     63 ```
     64 
     65 </section>
     66 
     67 <!-- /.usage -->
     68 
     69 <section class="examples">
     70 
     71 ## Examples
     72 
     73 <!-- eslint no-undef: "error" -->
     74 
     75 ```javascript
     76 var linspace = require( '@stdlib/array/linspace' );
     77 var TWO_PI = require( '@stdlib/constants/float64/two-pi' );
     78 var havercos = require( '@stdlib/math/base/special/havercos' );
     79 
     80 var x = linspace( 0.0, TWO_PI, 100 );
     81 var i;
     82 
     83 for ( i = 0; i < x.length; i++ ) {
     84     console.log( havercos( x[ i ] ) );
     85 }
     86 ```
     87 
     88 </section>
     89 
     90 <!-- /.examples -->
     91 
     92 <section class="links">
     93 
     94 [versed-cosine]: https://en.wikipedia.org/wiki/Versine
     95 
     96 </section>
     97 
     98 <!-- /.links -->