forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsch.js
More file actions
37 lines (35 loc) · 1 KB
/
csch.js
File metadata and controls
37 lines (35 loc) · 1 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
import { factory } from '../../utils/factory.js'
import { cschNumber } from '../../plain/number/index.js'
const name = 'csch'
const dependencies = ['typed', 'BigNumber']
export const createCsch = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {
/**
* Calculate the hyperbolic cosecant of a value,
* defined as `csch(x) = 1 / sinh(x)`.
*
* To avoid confusion with the matrix hyperbolic cosecant, this function
* does not apply to matrices.
*
* Syntax:
*
* math.csch(x)
*
* Examples:
*
* // csch(x) = 1/ sinh(x)
* math.csch(0.5) // returns 1.9190347513349437
* 1 / math.sinh(0.5) // returns 1.9190347513349437
*
* See also:
*
* sinh, sech, coth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic cosecant of x
*/
return typed(name, {
number: cschNumber,
Complex: x => x.csch(),
BigNumber: x => new BigNumber(1).div(x.sinh())
})
})