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 | var acosh = typed('acosh', {
|
28 | 'number': function number(x) {
|
29 | if (x >= 1 || config.predictable) {
|
30 | return _acosh(x);
|
31 | }
|
32 | if (x <= -1) {
|
33 | return new type.Complex(Math.log(Math.sqrt(x * x - 1) - x), Math.PI);
|
34 | }
|
35 | return new type.Complex(x, 0).acosh();
|
36 | },
|
37 |
|
38 | 'Complex': function Complex(x) {
|
39 | return x.acosh();
|
40 | },
|
41 |
|
42 | 'BigNumber': function BigNumber(x) {
|
43 | return x.acosh();
|
44 | },
|
45 |
|
46 | 'Array | Matrix': function ArrayMatrix(x) {
|
47 | return deepMap(x, acosh);
|
48 | }
|
49 | });
|
50 |
|
51 | acosh.toTex = { 1: '\\cosh^{-1}\\left(${args[0]}\\right)' };
|
52 |
|
53 | return acosh;
|
54 | }
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | var _acosh = Math.acosh || function (x) {
|
63 | return Math.log(Math.sqrt(x * x - 1) + x);
|
64 | };
|
65 |
|
66 | exports.name = 'acosh';
|
67 | exports.factory = factory; |
\ | No newline at end of file |