README.md (2161B)
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 # Tangent 22 23 > Evaluate the [tangent][tangent] of a number. 24 25 <section class="intro"> 26 27 The [tangent][tangent] is defined as 28 29 <!-- <equation class="equation" label="eq:tangent" align="center" raw="\tan x = \frac{\sin x}{\cos x}" alt="Tangent definition."> --> 30 31 <div class="equation" align="center" data-raw-text="\tan x = \frac{\sin x}{\cos x}" data-equation="eq:tangent"> 32 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/tan/docs/img/equation_tangent.svg" alt="Tangent definition."> 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 tan = require( '@stdlib/math/base/special/tan' ); 48 ``` 49 50 #### tan( x ) 51 52 Evaluates the [tangent][tangent] of a `number` (in radians). 53 54 ```javascript 55 var v = tan( 0.0 ); 56 // returns ~0.0 57 58 v = tan( -3.141592653589793/4.0 ); 59 // returns ~-1.0 60 61 v = tan( 3.141592653589793/4.0 ); 62 // returns ~1.0 63 64 v = tan( NaN ); 65 // returns NaN 66 ``` 67 68 </section> 69 70 <!-- /.usage --> 71 72 <section class="examples"> 73 74 ## Examples 75 76 <!-- eslint no-undef: "error" --> 77 78 ```javascript 79 var linspace = require( '@stdlib/array/linspace' ); 80 var PI = require( '@stdlib/constants/float64/pi' ); 81 var tan = require( '@stdlib/math/base/special/tan' ); 82 83 var x = linspace( -PI/2.0, PI/2.0, 100 ); 84 var i; 85 86 for ( i = 0; i < x.length; i++ ) { 87 console.log( tan( x[ i ] ) ); 88 } 89 ``` 90 91 </section> 92 93 <!-- /.examples --> 94 95 <section class="links"> 96 97 [tangent]: http://mathworld.wolfram.com/Tangent.html 98 99 </section> 100 101 <!-- /.links -->