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