simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

atan.js (1451B)


      1 "use strict";
      2 
      3 Object.defineProperty(exports, "__esModule", {
      4   value: true
      5 });
      6 exports.createAtan = void 0;
      7 
      8 var _factory = require("../../utils/factory.js");
      9 
     10 var _collection = require("../../utils/collection.js");
     11 
     12 var name = 'atan';
     13 var dependencies = ['typed'];
     14 var 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   return 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, this, true);
     53     }
     54   });
     55 });
     56 exports.createAtan = createAtan;