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 asec = typed('asec', {
|
30 | 'number': function number(x) {
|
31 | if (x <= -1 || x >= 1 || config.predictable) {
|
32 | return Math.acos(1 / x);
|
33 | }
|
34 | return new type.Complex(x, 0).asec();
|
35 | },
|
36 |
|
37 | 'Complex': function Complex(x) {
|
38 | return x.asec();
|
39 | },
|
40 |
|
41 | 'BigNumber': function BigNumber(x) {
|
42 | return new type.BigNumber(1).div(x).acos();
|
43 | },
|
44 |
|
45 | 'Array | Matrix': function ArrayMatrix(x) {
|
46 | return deepMap(x, asec);
|
47 | }
|
48 | });
|
49 |
|
50 | asec.toTex = { 1: '\\sec^{-1}\\left(${args[0]}\\right)' };
|
51 |
|
52 | return asec;
|
53 | }
|
54 |
|
55 | exports.name = 'asec';
|
56 | exports.factory = factory; |
\ | No newline at end of file |