forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacsch.js
More file actions
45 lines (40 loc) · 1.09 KB
/
acsch.js
File metadata and controls
45 lines (40 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { factory } from '../../utils/factory.js'
import { deepMap } from '../../utils/collection.js'
import { acschNumber } from '../../plain/number/index.js'
const name = 'acsch'
const dependencies = ['typed', 'BigNumber']
export const createAcsch = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {
/**
* Calculate the hyperbolic arccosecant of a value,
* defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`.
*
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.acsch(x)
*
* Examples:
*
* math.acsch(0.5) // returns 1.4436354751788103
*
* See also:
*
* asech, acoth
*
* @param {number | Complex | Array | Matrix} x Function input
* @return {number | Complex | Array | Matrix} Hyperbolic arccosecant of x
*/
return typed(name, {
number: acschNumber,
Complex: function (x) {
return x.acsch()
},
BigNumber: function (x) {
return new BigNumber(1).div(x).asinh()
},
'Array | Matrix': function (x) {
return deepMap(x, this)
}
})
})