simple-squiggle

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

asinh.js (1348B)


      1 "use strict";
      2 
      3 Object.defineProperty(exports, "__esModule", {
      4   value: true
      5 });
      6 exports.createAsinh = 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 = 'asinh';
     15 var dependencies = ['typed'];
     16 var createAsinh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
     17   var typed = _ref.typed;
     18 
     19   /**
     20    * Calculate the hyperbolic arcsine of a value,
     21    * defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.
     22    *
     23    * For matrices, the function is evaluated element wise.
     24    *
     25    * Syntax:
     26    *
     27    *    math.asinh(x)
     28    *
     29    * Examples:
     30    *
     31    *    math.asinh(0.5)       // returns 0.48121182505960347
     32    *
     33    * See also:
     34    *
     35    *    acosh, atanh
     36    *
     37    * @param {number | Complex | Array | Matrix} x  Function input
     38    * @return {number | Complex | Array | Matrix} Hyperbolic arcsine of x
     39    */
     40   return typed('asinh', {
     41     number: _index.asinhNumber,
     42     Complex: function Complex(x) {
     43       return x.asinh();
     44     },
     45     BigNumber: function BigNumber(x) {
     46       return x.asinh();
     47     },
     48     'Array | Matrix': function ArrayMatrix(x) {
     49       // deep map collection, skip zeros since asinh(0) = 0
     50       return (0, _collection.deepMap)(x, this, true);
     51     }
     52   });
     53 });
     54 exports.createAsinh = createAsinh;