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 csc = typed('csc', {
|
28 | 'number': function (x) {
|
29 | return 1 / Math.sin(x)
|
30 | },
|
31 |
|
32 | 'Complex': function (x) {
|
33 | return x.csc()
|
34 | },
|
35 |
|
36 | 'BigNumber': function (x) {
|
37 | return new type.BigNumber(1).div(x.sin())
|
38 | },
|
39 |
|
40 | 'Unit': function (x) {
|
41 | if (!x.hasBase(type.Unit.BASE_UNITS.ANGLE)) {
|
42 | throw new TypeError('Unit in function csc is no angle')
|
43 | }
|
44 | return csc(x.value)
|
45 | },
|
46 |
|
47 | 'Array | Matrix': function (x) {
|
48 | return deepMap(x, csc)
|
49 | }
|
50 | })
|
51 |
|
52 | csc.toTex = { 1: `\\csc\\left(\${args[0]}\\right)` }
|
53 |
|
54 | return csc
|
55 | }
|
56 |
|
57 | exports.name = 'csc'
|
58 | exports.factory = factory
|