-
Notifications
You must be signed in to change notification settings - Fork 34
/
complex.d.ts
323 lines (317 loc) · 5.44 KB
/
complex.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
type AValue =
| Complex
| { im: number; re: number }
| { abs: number; arg: number }
| { r: number; phi: number }
| [number, number]
| string
| number
| null
| undefined;
type BValue = number | undefined;
export function Complex(a: AValue, b?: BValue): Complex;
export default Complex;
/**
*
* This class allows the manipulation of complex numbers.
* You can pass a complex number in different formats. Either as object, double, string or two integer parameters.
*
* Object form
* { re: <real>, im: <imaginary> }
* { arg: <angle>, abs: <radius> }
* { phi: <angle>, r: <radius> }
*
* Array / Vector form
* [ real, imaginary ]
*
* Double form
* 99.3 - Single double value
*
* String form
* '23.1337' - Simple real number
* '15+3i' - a simple complex number
* '3-i' - a simple complex number
*
* Example:
*
* var c = new Complex('99.3+8i');
* c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);
*
*/
export class Complex {
re: number;
im: number;
constructor(a: AValue, b?: BValue);
/**
* Calculates the sign of a complex number, which is a normalized complex
*
*/
sign(): Complex;
/**
* Adds two complex numbers
*
*/
add(a: AValue, b?: BValue): Complex;
/**
* Subtracts two complex numbers
*
*/
sub(a: AValue, b?: BValue): Complex;
/**
* Multiplies two complex numbers
*
*/
mul(a: AValue, b?: BValue): Complex;
/**
* Divides two complex numbers
*
*/
div(a: AValue, b?: BValue): Complex;
/**
* Calculate the power of two complex numbers
*
*/
pow(a: AValue, b?: BValue): Complex;
/**
* Calculate the complex square root
*
*/
sqrt(): Complex;
/**
* Calculate the complex exponent
*
*/
exp(): Complex;
/**
* Calculate the complex exponent and subtracts one.
*
* This may be more accurate than `Complex(x).exp().sub(1)` if
* `x` is small.
*
*/
expm1(): Complex;
/**
* Calculate the natural log
*
*/
log(): Complex;
/**
* Calculate the magnitude of the complex number
*
*/
abs(): number;
/**
* Calculate the angle of the complex number
*
*/
arg(): number;
/**
* Calculate the sine of the complex number
*
*/
sin(): Complex;
/**
* Calculate the cosine
*
*/
cos(): Complex;
/**
* Calculate the tangent
*
*/
tan(): Complex;
/**
* Calculate the cotangent
*
*/
cot(): Complex;
/**
* Calculate the secant
*
*/
sec(): Complex;
/**
* Calculate the cosecans
*
*/
csc(): Complex;
/**
* Calculate the complex arcus sinus
*
*/
asin(): Complex;
/**
* Calculate the complex arcus cosinus
*
*/
acos(): Complex;
/**
* Calculate the complex arcus tangent
*
*/
atan(): Complex;
/**
* Calculate the complex arcus cotangent
*
*/
acot(): Complex;
/**
* Calculate the complex arcus secant
*
*/
asec(): Complex;
/**
* Calculate the complex arcus cosecans
*
*/
acsc(): Complex;
/**
* Calculate the complex sinh
*
*/
sinh(): Complex;
/**
* Calculate the complex cosh
*
*/
cosh(): Complex;
/**
* Calculate the complex tanh
*
*/
tanh(): Complex;
/**
* Calculate the complex coth
*
*/
coth(): Complex;
/**
* Calculate the complex coth
*
*/
csch(): Complex;
/**
* Calculate the complex sech
*
*/
sech(): Complex;
/**
* Calculate the complex asinh
*
*/
asinh(): Complex;
/**
* Calculate the complex acosh
*
*/
acosh(): Complex;
/**
* Calculate the complex atanh
*
*/
atanh(): Complex;
/**
* Calculate the complex acoth
*
*/
acoth(): Complex;
/**
* Calculate the complex acsch
*
*/
acsch(): Complex;
/**
* Calculate the complex asech
*
*/
asech(): Complex;
/**
* Calculate the complex inverse 1/z
*
*/
inverse(): Complex;
/**
* Returns the complex conjugate
*
*/
conjugate(): Complex;
/**
* Gets the negated complex number
*
*/
neg(): Complex;
/**
* Ceils the actual complex number
*
*/
ceil(places: number): Complex;
/**
* Floors the actual complex number
*
*/
floor(places: number): Complex;
/**
* Ceils the actual complex number
*
*/
round(places: number): Complex;
/**
* Compares two complex numbers
*
* **Note:** new Complex(Infinity).equals(Infinity) === false
*
*/
equals(a: AValue, b?: BValue): boolean;
/**
* Clones the actual object
*
*/
clone(): Complex;
/**
* Gets a string of the actual complex number
*
*/
toString(): string;
/**
* Returns the actual number as a vector
*
*/
toVector(): number[];
/**
* Returns the actual real value of the current object
*
* @returns {number|null}
*/
valueOf(): number | null;
/**
* Determines whether a complex number is not on the Riemann sphere.
*
*/
isNaN(): boolean;
/**
* Determines whether or not a complex number is at the zero pole of the
* Riemann sphere.
*
*/
isZero(): boolean;
/**
* Determines whether a complex number is not at the infinity pole of the
* Riemann sphere.
*
*/
isFinite(): boolean;
/**
* Determines whether or not a complex number is at the infinity pole of the
* Riemann sphere.
*
*/
isInfinite(): boolean;
static ZERO: Complex;
static ONE: Complex;
static I: Complex;
static PI: Complex;
static E: Complex;
static INFINITY: Complex;
static NAN: Complex;
static EPSILON: number;
}