atan.js (1275B)
1 import { factory } from '../../utils/factory.js'; 2 import { deepMap } from '../../utils/collection.js'; 3 var name = 'atan'; 4 var dependencies = ['typed']; 5 export var createAtan = /* #__PURE__ */factory(name, dependencies, _ref => { 6 var { 7 typed 8 } = _ref; 9 10 /** 11 * Calculate the inverse tangent of a value. 12 * 13 * For matrices, the function is evaluated element wise. 14 * 15 * Syntax: 16 * 17 * math.atan(x) 18 * 19 * Examples: 20 * 21 * math.atan(0.5) // returns number 0.4636476090008061 22 * math.atan(math.tan(1.5)) // returns number 1.5 23 * 24 * math.atan(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i 25 * 26 * See also: 27 * 28 * tan, asin, acos 29 * 30 * @param {number | BigNumber | Complex | Array | Matrix} x Function input 31 * @return {number | BigNumber | Complex | Array | Matrix} The arc tangent of x 32 */ 33 return typed('atan', { 34 number: function number(x) { 35 return Math.atan(x); 36 }, 37 Complex: function Complex(x) { 38 return x.atan(); 39 }, 40 BigNumber: function BigNumber(x) { 41 return x.atan(); 42 }, 43 'Array | Matrix': function ArrayMatrix(x) { 44 // deep map collection, skip zeros since atan(0) = 0 45 return deepMap(x, this, true); 46 } 47 }); 48 });