UNPKG

1.46 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.createAtan = void 0;
7
8var _factory = require("../../utils/factory");
9
10var _collection = require("../../utils/collection");
11
12var name = 'atan';
13var dependencies = ['typed'];
14var createAtan = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
15 var typed = _ref.typed;
16
17 /**
18 * Calculate the inverse tangent of a value.
19 *
20 * For matrices, the function is evaluated element wise.
21 *
22 * Syntax:
23 *
24 * math.atan(x)
25 *
26 * Examples:
27 *
28 * math.atan(0.5) // returns number 0.4636476090008061
29 * math.atan(math.tan(1.5)) // returns number 1.5
30 *
31 * math.atan(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
32 *
33 * See also:
34 *
35 * tan, asin, acos
36 *
37 * @param {number | BigNumber | Complex | Array | Matrix} x Function input
38 * @return {number | BigNumber | Complex | Array | Matrix} The arc tangent of x
39 */
40 var atan = typed('atan', {
41 number: function number(x) {
42 return Math.atan(x);
43 },
44 Complex: function Complex(x) {
45 return x.atan();
46 },
47 BigNumber: function BigNumber(x) {
48 return x.atan();
49 },
50 'Array | Matrix': function ArrayMatrix(x) {
51 // deep map collection, skip zeros since atan(0) = 0
52 return (0, _collection.deepMap)(x, atan, true);
53 }
54 });
55 return atan;
56});
57exports.createAtan = createAtan;
\No newline at end of file