simple-squiggle

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

asinh.js (1167B)


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