UNPKG

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