1 | 'use strict'
|
2 |
|
3 | const deepMap = require('../../utils/collection/deepMap')
|
4 |
|
5 | function factory (type, config, load, typed) {
|
6 | |
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | const acoth = typed('acoth', {
|
28 | 'number': function (x) {
|
29 | if (x >= 1 || x <= -1 || config.predictable) {
|
30 | return isFinite(x) ? (Math.log((x + 1) / x) + Math.log(x / (x - 1))) / 2 : 0
|
31 | }
|
32 | return new type.Complex(x, 0).acoth()
|
33 | },
|
34 |
|
35 | 'Complex': function (x) {
|
36 | return x.acoth()
|
37 | },
|
38 |
|
39 | 'BigNumber': function (x) {
|
40 | return new type.BigNumber(1).div(x).atanh()
|
41 | },
|
42 |
|
43 | 'Array | Matrix': function (x) {
|
44 | return deepMap(x, acoth)
|
45 | }
|
46 | })
|
47 |
|
48 | acoth.toTex = { 1: `\\coth^{-1}\\left(\${args[0]}\\right)` }
|
49 |
|
50 | return acoth
|
51 | }
|
52 |
|
53 | exports.name = 'acoth'
|
54 | exports.factory = factory
|