README.md (1688B)
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 # acos 22 23 > Compute the [arccosine][arccosine] of a number. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var acos = require( '@stdlib/math/base/special/acos' ); 31 ``` 32 33 #### acos( x ) 34 35 Computes the [arccosine][arccosine] of a `number` (in radians). 36 37 ```javascript 38 var v = acos( 1.0 ); 39 // returns 0.0 40 41 v = acos( 0.707 ); // ~pi/4 42 // returns ~0.7855 43 44 v = acos( 0.866 ); // ~pi/6 45 // returns ~0.5236 46 47 v = acos( NaN ); 48 // returns NaN 49 ``` 50 51 The domain of `x` is restricted to `[-1,1]`. If `|x| > 1`, the function returns `NaN`. 52 53 ```javascript 54 var v = acos( -3.14 ); 55 // returns NaN 56 ``` 57 58 </section> 59 60 <!-- /.usage --> 61 62 <section class="examples"> 63 64 ## Examples 65 66 <!-- eslint no-undef: "error" --> 67 68 ```javascript 69 var linspace = require( '@stdlib/array/linspace' ); 70 var acos = require( '@stdlib/math/base/special/acos' ); 71 72 var x = linspace( -1.0, 1.0, 100 ); 73 var i; 74 75 for ( i = 0; i < x.length; i++ ) { 76 console.log( acos( x[ i ] ) ); 77 } 78 ``` 79 80 </section> 81 82 <!-- /.examples --> 83 84 <section class="links"> 85 86 [arccosine]: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions 87 88 </section> 89 90 <!-- /.links -->