UNPKG

1.62 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.createAcoth = void 0;
7
8var _factory = require("../../utils/factory");
9
10var _collection = require("../../utils/collection");
11
12var _number = require("../../plain/number");
13
14var name = 'acoth';
15var dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
16var createAcoth = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
17 var typed = _ref.typed,
18 config = _ref.config,
19 Complex = _ref.Complex,
20 _BigNumber = _ref.BigNumber;
21
22 /**
23 * Calculate the hyperbolic arccotangent of a value,
24 * defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.
25 *
26 * For matrices, the function is evaluated element wise.
27 *
28 * Syntax:
29 *
30 * math.acoth(x)
31 *
32 * Examples:
33 *
34 * math.acoth(0.5) // returns 0.8047189562170503
35 *
36 * See also:
37 *
38 * acsch, asech
39 *
40 * @param {number | Complex | Array | Matrix} x Function input
41 * @return {number | Complex | Array | Matrix} Hyperbolic arccotangent of x
42 */
43 var acoth = typed(name, {
44 number: function number(x) {
45 if (x >= 1 || x <= -1 || config.predictable) {
46 return (0, _number.acothNumber)(x);
47 }
48
49 return new Complex(x, 0).acoth();
50 },
51 Complex: function Complex(x) {
52 return x.acoth();
53 },
54 BigNumber: function BigNumber(x) {
55 return new _BigNumber(1).div(x).atanh();
56 },
57 'Array | Matrix': function ArrayMatrix(x) {
58 return (0, _collection.deepMap)(x, acoth);
59 }
60 });
61 return acoth;
62});
63exports.createAcoth = createAcoth;
\No newline at end of file