simple-squiggle

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

acsch.js (1185B)


      1 import { factory } from '../../utils/factory.js';
      2 import { deepMap } from '../../utils/collection.js';
      3 import { acschNumber } from '../../plain/number/index.js';
      4 var name = 'acsch';
      5 var dependencies = ['typed', 'BigNumber'];
      6 export var createAcsch = /* #__PURE__ */factory(name, dependencies, _ref => {
      7   var {
      8     typed,
      9     BigNumber: _BigNumber
     10   } = _ref;
     11 
     12   /**
     13    * Calculate the hyperbolic arccosecant of a value,
     14    * defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`.
     15    *
     16    * For matrices, the function is evaluated element wise.
     17    *
     18    * Syntax:
     19    *
     20    *    math.acsch(x)
     21    *
     22    * Examples:
     23    *
     24    *    math.acsch(0.5)       // returns 1.4436354751788103
     25    *
     26    * See also:
     27    *
     28    *    asech, acoth
     29    *
     30    * @param {number | Complex | Array | Matrix} x  Function input
     31    * @return {number | Complex | Array | Matrix} Hyperbolic arccosecant of x
     32    */
     33   return typed(name, {
     34     number: acschNumber,
     35     Complex: function Complex(x) {
     36       return x.acsch();
     37     },
     38     BigNumber: function BigNumber(x) {
     39       return new _BigNumber(1).div(x).asinh();
     40     },
     41     'Array | Matrix': function ArrayMatrix(x) {
     42       return deepMap(x, this);
     43     }
     44   });
     45 });