1 | 'use strict';
|
2 |
|
3 | var 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 |
|
28 |
|
29 | var coth = typed('coth', {
|
30 | 'number': _coth,
|
31 |
|
32 | 'Complex': function Complex(x) {
|
33 | return x.coth();
|
34 | },
|
35 |
|
36 | 'BigNumber': function BigNumber(x) {
|
37 | return new type.BigNumber(1).div(x.tanh());
|
38 | },
|
39 |
|
40 | 'Unit': function Unit(x) {
|
41 | if (!x.hasBase(type.Unit.BASE_UNITS.ANGLE)) {
|
42 | throw new TypeError('Unit in function coth is no angle');
|
43 | }
|
44 | return coth(x.value);
|
45 | },
|
46 |
|
47 | 'Array | Matrix': function ArrayMatrix(x) {
|
48 | return deepMap(x, coth);
|
49 | }
|
50 | });
|
51 |
|
52 | coth.toTex = { 1: '\\coth\\left(${args[0]}\\right)' };
|
53 |
|
54 | return coth;
|
55 | }
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | function _coth(x) {
|
64 | var e = Math.exp(2 * x);
|
65 | return (e + 1) / (e - 1);
|
66 | }
|
67 |
|
68 | exports.name = 'coth';
|
69 | exports.factory = factory; |
\ | No newline at end of file |