UNPKG

1.18 kBJavaScriptView Raw
1import { factory } from '../../utils/factory';
2import { deepMap } from '../../utils/collection';
3import { asinhNumber } from '../../plain/number';
4var name = 'asinh';
5var dependencies = ['typed'];
6export var createAsinh =
7/* #__PURE__ */
8factory(name, dependencies, function (_ref) {
9 var typed = _ref.typed;
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 var asinh = 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, asinh, true);
43 }
44 });
45 return asinh;
46});
\No newline at end of file