simple-squiggle

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

acot.js (1481B)


      1 "use strict";
      2 
      3 Object.defineProperty(exports, "__esModule", {
      4   value: true
      5 });
      6 exports.createAcot = void 0;
      7 
      8 var _factory = require("../../utils/factory.js");
      9 
     10 var _collection = require("../../utils/collection.js");
     11 
     12 var _index = require("../../plain/number/index.js");
     13 
     14 var name = 'acot';
     15 var dependencies = ['typed', 'BigNumber'];
     16 var createAcot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
     17   var typed = _ref.typed,
     18       _BigNumber = _ref.BigNumber;
     19 
     20   /**
     21    * Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`.
     22    *
     23    * For matrices, the function is evaluated element wise.
     24    *
     25    * Syntax:
     26    *
     27    *    math.acot(x)
     28    *
     29    * Examples:
     30    *
     31    *    math.acot(0.5)           // returns number 0.4636476090008061
     32    *    math.acot(math.cot(1.5)) // returns number 1.5
     33    *
     34    *    math.acot(2)             // returns Complex 1.5707963267948966 -1.3169578969248166 i
     35    *
     36    * See also:
     37    *
     38    *    cot, atan
     39    *
     40    * @param {number | Complex | Array | Matrix} x   Function input
     41    * @return {number | Complex | Array | Matrix} The arc cotangent of x
     42    */
     43   return typed(name, {
     44     number: _index.acotNumber,
     45     Complex: function Complex(x) {
     46       return x.acot();
     47     },
     48     BigNumber: function BigNumber(x) {
     49       return new _BigNumber(1).div(x).atan();
     50     },
     51     'Array | Matrix': function ArrayMatrix(x) {
     52       return (0, _collection.deepMap)(x, this);
     53     }
     54   });
     55 });
     56 exports.createAcot = createAcot;