@danielsimonjr/mathts-core 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arithmetic/scalar.d.ts +56 -0
- package/dist/arithmetic/scalar.d.ts.map +1 -0
- package/dist/array.d.ts +253 -0
- package/dist/array.d.ts.map +1 -0
- package/dist/bignumber-formatter.d.ts +135 -0
- package/dist/bignumber-formatter.d.ts.map +1 -0
- package/dist/{chunk-VPK5YTKG.js → chunk-L5MWGOLB.js} +111 -29
- package/dist/collection.d.ts +67 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/customs.d.ts +44 -0
- package/dist/customs.d.ts.map +1 -0
- package/dist/error/DimensionError.d.ts +26 -0
- package/dist/error/DimensionError.d.ts.map +1 -0
- package/dist/error/IndexError.d.ts +33 -0
- package/dist/error/IndexError.d.ts.map +1 -0
- package/dist/error/MathjsError.d.ts +13 -0
- package/dist/error/MathjsError.d.ts.map +1 -0
- package/dist/factory/factory.d.ts +154 -0
- package/dist/factory/factory.d.ts.map +1 -0
- package/dist/factory/index.d.ts +6 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory.d.ts +112 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +24 -2585
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -18
- package/dist/internal.d.ts +33 -1344
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -3
- package/dist/is.d.ts +102 -0
- package/dist/is.d.ts.map +1 -0
- package/dist/map.d.ts +113 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/number.d.ts +314 -0
- package/dist/number.d.ts.map +1 -0
- package/dist/numeric/stable.d.ts +130 -0
- package/dist/numeric/stable.d.ts.map +1 -0
- package/dist/object.d.ts +119 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/shared.d.ts +41 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/string.d.ts +70 -0
- package/dist/string.d.ts.map +1 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/typed/index.d.ts +7 -0
- package/dist/typed/index.d.ts.map +1 -0
- package/dist/typed/mathts-typed.d.ts +246 -0
- package/dist/typed/mathts-typed.d.ts.map +1 -0
- package/dist/typed/type-bridge.d.ts +2 -0
- package/dist/typed/type-bridge.d.ts.map +1 -0
- package/dist/types/bignumber.d.ts +367 -0
- package/dist/types/bignumber.d.ts.map +1 -0
- package/dist/types/complex.d.ts +284 -0
- package/dist/types/complex.d.ts.map +1 -0
- package/dist/types/dual-rules.d.ts +129 -0
- package/dist/types/dual-rules.d.ts.map +1 -0
- package/dist/types/dual.d.ts +36 -0
- package/dist/types/dual.d.ts.map +1 -0
- package/dist/types/fraction.d.ts +215 -0
- package/dist/types/fraction.d.ts.map +1 -0
- package/dist/types/interfaces.d.ts +143 -0
- package/dist/types/interfaces.d.ts.map +1 -0
- package/dist/types/matrix/Range.d.ts +767 -0
- package/dist/types/matrix/Range.d.ts.map +1 -0
- package/dist/types/unit/Unit.d.ts +3 -0
- package/dist/types/unit/Unit.d.ts.map +1 -0
- package/dist/types/unit/dependencies.d.ts +4 -0
- package/dist/types/unit/dependencies.d.ts.map +1 -0
- package/dist/types/unit/errors.d.ts +18 -0
- package/dist/types/unit/errors.d.ts.map +1 -0
- package/dist/types/unit/index.d.ts +7 -0
- package/dist/types/unit/index.d.ts.map +1 -0
- package/dist/types/unit/unit-types.d.ts +231 -0
- package/dist/types/unit/unit-types.d.ts.map +1 -0
- package/dist/types/unit-definitions.d.ts +79 -0
- package/dist/types/unit-definitions.d.ts.map +1 -0
- package/dist/types/unit-prefixes.d.ts +29 -0
- package/dist/types/unit-prefixes.d.ts.map +1 -0
- package/dist/types/unit.d.ts +28 -0
- package/dist/types/unit.d.ts.map +1 -0
- package/dist/types/wasm-loader.d.ts +35 -0
- package/dist/types/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.d.ts +97 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/index-B4LIOfHN.d.ts +0 -449
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../src/typed/type-bridge.ts"],"names":[],"mappings":"AAeA,wBAAgB,mBAAmB,IAAI,IAAI,CAyD1C"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BigNumber (arbitrary precision decimal) implementation
|
|
3
|
+
* @module @danielsimonjr/mathts-core/types/bignumber
|
|
4
|
+
*/
|
|
5
|
+
import type { Scalar, MathTSValue } from './interfaces';
|
|
6
|
+
/**
|
|
7
|
+
* Check if a value is a BigNumber
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBigNumber(value: unknown): value is BigNumber;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for BigNumber operations
|
|
12
|
+
*/
|
|
13
|
+
export interface BigNumberConfig {
|
|
14
|
+
/** Number of significant digits (default: 64) */
|
|
15
|
+
precision: number;
|
|
16
|
+
/** Rounding mode (default: 'halfUp') */
|
|
17
|
+
rounding: RoundingMode;
|
|
18
|
+
/** Minimum exponent (default: -1e9) */
|
|
19
|
+
minExponent: number;
|
|
20
|
+
/** Maximum exponent (default: 1e9) */
|
|
21
|
+
maxExponent: number;
|
|
22
|
+
}
|
|
23
|
+
export type RoundingMode = 'up' | 'down' | 'ceil' | 'floor' | 'halfUp' | 'halfDown' | 'halfEven' | 'halfCeil' | 'halfFloor';
|
|
24
|
+
/**
|
|
25
|
+
* BigNumber class for arbitrary precision decimal arithmetic
|
|
26
|
+
*
|
|
27
|
+
* Internally stores: sign * coefficient * 10^exponent
|
|
28
|
+
* where coefficient is a bigint with the significant digits.
|
|
29
|
+
*/
|
|
30
|
+
export declare class BigNumber implements MathTSValue {
|
|
31
|
+
readonly type = "BigNumber";
|
|
32
|
+
/**
|
|
33
|
+
* Duck-typing marker for Decimal.js / mathjs formatter compatibility.
|
|
34
|
+
* Allows external code that checks `obj.isBigNumber === true` to identify
|
|
35
|
+
* this class without an `instanceof` check.
|
|
36
|
+
*/
|
|
37
|
+
readonly isBigNumber = true;
|
|
38
|
+
private readonly _sign;
|
|
39
|
+
private readonly _coefficient;
|
|
40
|
+
private readonly _exponent;
|
|
41
|
+
private readonly _isNaN;
|
|
42
|
+
private readonly _isInfinite;
|
|
43
|
+
private constructor();
|
|
44
|
+
/**
|
|
45
|
+
* Create a BigNumber from a number
|
|
46
|
+
*/
|
|
47
|
+
static fromNumber(n: number): BigNumber;
|
|
48
|
+
/**
|
|
49
|
+
* Create a BigNumber from a string
|
|
50
|
+
*/
|
|
51
|
+
static parse(str: string): BigNumber;
|
|
52
|
+
/**
|
|
53
|
+
* Create from bigint
|
|
54
|
+
*/
|
|
55
|
+
static fromBigInt(n: bigint): BigNumber;
|
|
56
|
+
/**
|
|
57
|
+
* Create a BigNumber from a JSON object
|
|
58
|
+
*/
|
|
59
|
+
static fromJSON(json: {
|
|
60
|
+
value: string;
|
|
61
|
+
}): BigNumber;
|
|
62
|
+
/**
|
|
63
|
+
* Get/set global configuration
|
|
64
|
+
*/
|
|
65
|
+
static config(newConfig?: Partial<BigNumberConfig>): BigNumberConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Reset configuration to defaults
|
|
68
|
+
*/
|
|
69
|
+
static resetConfig(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Compare two BigNumbers
|
|
72
|
+
* @returns -1, 0, or 1
|
|
73
|
+
*/
|
|
74
|
+
static compare(a: BigNumber, b: BigNumber): number;
|
|
75
|
+
private static compareMagnitude;
|
|
76
|
+
valueOf(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Convert to a JS number.
|
|
79
|
+
* Alias for `valueOf()` — provided for Decimal.js / mathjs formatter
|
|
80
|
+
* duck-typing compatibility.
|
|
81
|
+
*/
|
|
82
|
+
toNumber(): number;
|
|
83
|
+
toString(): string;
|
|
84
|
+
toJSON(): {
|
|
85
|
+
mathjs: string;
|
|
86
|
+
value: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Convert to fixed-point notation.
|
|
90
|
+
*
|
|
91
|
+
* When called with no argument (or `undefined`) returns the full fixed-point
|
|
92
|
+
* string representation without rounding — matching Decimal.js semantics where
|
|
93
|
+
* `toFixed()` is equivalent to a lossless fixed-point stringify.
|
|
94
|
+
* When called with a non-negative integer `decimalPlaces`, rounds and formats
|
|
95
|
+
* to exactly that many digits after the decimal point.
|
|
96
|
+
*/
|
|
97
|
+
toFixed(decimalPlaces?: number): string;
|
|
98
|
+
private toFixedInternal;
|
|
99
|
+
/**
|
|
100
|
+
* Convert to exponential notation
|
|
101
|
+
*/
|
|
102
|
+
toExponential(decimalPlaces?: number): string;
|
|
103
|
+
/**
|
|
104
|
+
* Convert to precision
|
|
105
|
+
*/
|
|
106
|
+
toPrecision(significantDigits?: number): string;
|
|
107
|
+
/**
|
|
108
|
+
* Convert to bigint (truncated)
|
|
109
|
+
*/
|
|
110
|
+
toBigInt(): bigint;
|
|
111
|
+
/**
|
|
112
|
+
* Binary string representation, e.g. `255 -> '0b11111111'`, `0.5 -> '0b0.1'`.
|
|
113
|
+
* Mirrors Decimal.js `toBinary()`. Negatives carry a leading `-`.
|
|
114
|
+
*/
|
|
115
|
+
toBinary(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Octal string representation, e.g. `8 -> '0o10'`.
|
|
118
|
+
* Mirrors Decimal.js `toOctal()`.
|
|
119
|
+
*/
|
|
120
|
+
toOctal(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Hexadecimal string representation, e.g. `255 -> '0xff'`, `10.5 -> '0xa.8'`.
|
|
123
|
+
* Mirrors Decimal.js `toHexadecimal()`.
|
|
124
|
+
*/
|
|
125
|
+
toHexadecimal(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Shared radix formatter for {@link toBinary}/{@link toOctal}/{@link toHexadecimal}.
|
|
128
|
+
* Integers and terminating fractions are exact; a non-terminating fraction is
|
|
129
|
+
* truncated at `maxFractionDigits` radix digits (a safety bound — the common
|
|
130
|
+
* use is integer formatting).
|
|
131
|
+
*/
|
|
132
|
+
private toRadixString;
|
|
133
|
+
/**
|
|
134
|
+
* Addition
|
|
135
|
+
*/
|
|
136
|
+
add(other: Scalar | BigNumber | number | string): BigNumber;
|
|
137
|
+
/**
|
|
138
|
+
* Subtraction
|
|
139
|
+
*/
|
|
140
|
+
subtract(other: Scalar | BigNumber | number | string): BigNumber;
|
|
141
|
+
/**
|
|
142
|
+
* Alias for subtract — mathjs / Decimal.js compatibility.
|
|
143
|
+
*/
|
|
144
|
+
sub(other: Scalar | BigNumber | number | string): BigNumber;
|
|
145
|
+
/**
|
|
146
|
+
* Multiplication
|
|
147
|
+
*/
|
|
148
|
+
multiply(other: Scalar | BigNumber | number | string): BigNumber;
|
|
149
|
+
/**
|
|
150
|
+
* Alias for multiply — mathjs / Decimal.js compatibility.
|
|
151
|
+
*/
|
|
152
|
+
mul(other: Scalar | BigNumber | number | string): BigNumber;
|
|
153
|
+
/**
|
|
154
|
+
* Alias for multiply — Decimal.js calling convention (used by the Unit).
|
|
155
|
+
*/
|
|
156
|
+
times(other: Scalar | BigNumber | number | string): BigNumber;
|
|
157
|
+
/**
|
|
158
|
+
* Division
|
|
159
|
+
*/
|
|
160
|
+
divide(other: Scalar | BigNumber | number | string): BigNumber;
|
|
161
|
+
/**
|
|
162
|
+
* Alias for divide — Decimal.js calling convention (used by the Unit).
|
|
163
|
+
*/
|
|
164
|
+
div(other: Scalar | BigNumber | number | string): BigNumber;
|
|
165
|
+
/**
|
|
166
|
+
* Negation
|
|
167
|
+
*/
|
|
168
|
+
negate(): BigNumber;
|
|
169
|
+
/**
|
|
170
|
+
* Absolute value
|
|
171
|
+
*/
|
|
172
|
+
abs(): BigNumber;
|
|
173
|
+
/**
|
|
174
|
+
* Power (integer exponent)
|
|
175
|
+
*/
|
|
176
|
+
pow(n: number | bigint): BigNumber;
|
|
177
|
+
/**
|
|
178
|
+
* Square root
|
|
179
|
+
*/
|
|
180
|
+
sqrt(): BigNumber;
|
|
181
|
+
equals(other: BigNumber | number | string): boolean;
|
|
182
|
+
lessThan(other: BigNumber | number | string): boolean;
|
|
183
|
+
lessThanOrEqual(other: BigNumber | number | string): boolean;
|
|
184
|
+
greaterThan(other: BigNumber | number | string): boolean;
|
|
185
|
+
greaterThanOrEqual(other: BigNumber | number | string): boolean;
|
|
186
|
+
compareTo(other: BigNumber | number | string): number;
|
|
187
|
+
compare(other: BigNumber | number | string): number;
|
|
188
|
+
/**
|
|
189
|
+
* Returns true iff this > other.
|
|
190
|
+
* Accepts the same argument types as `add`/`multiply` (BigNumber, number, or string).
|
|
191
|
+
* Named `gt` for Decimal.js / mathjs formatter compatibility.
|
|
192
|
+
*/
|
|
193
|
+
gt(other: BigNumber | number | string): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Round to specified decimal places
|
|
196
|
+
*/
|
|
197
|
+
round(decimalPlaces?: number, mode?: RoundingMode): BigNumber;
|
|
198
|
+
private shouldRound;
|
|
199
|
+
/**
|
|
200
|
+
* Round to specified precision (significant digits)
|
|
201
|
+
*/
|
|
202
|
+
roundToPrecision(precision: number, mode?: RoundingMode): BigNumber;
|
|
203
|
+
floor(): BigNumber;
|
|
204
|
+
ceil(): BigNumber;
|
|
205
|
+
trunc(): BigNumber;
|
|
206
|
+
/**
|
|
207
|
+
* Round to `n` significant decimal digits and return a new BigNumber.
|
|
208
|
+
* Delegates to `roundToPrecision`, using the global rounding mode unless
|
|
209
|
+
* an explicit `roundingMode` is supplied.
|
|
210
|
+
*
|
|
211
|
+
* Named `toSignificantDigits` for Decimal.js / mathjs formatter compatibility.
|
|
212
|
+
* When `n` is undefined the value is returned unchanged (no rounding).
|
|
213
|
+
*/
|
|
214
|
+
toSignificantDigits(n?: number, roundingMode?: RoundingMode): BigNumber;
|
|
215
|
+
/**
|
|
216
|
+
* The decimal exponent of this number: `floor(log10(|x|))`.
|
|
217
|
+
*
|
|
218
|
+
* Matches Decimal.js semantics:
|
|
219
|
+
* - `12345` → `4` (5 digits → the most-significant place is 10^4)
|
|
220
|
+
* - `0.0123` → `-2` (first significant digit is at 10^-2)
|
|
221
|
+
* - `100` → `2`
|
|
222
|
+
* - `0.01` → `-2`
|
|
223
|
+
* - `0` → `0` (by convention; `isZero()` can be used to distinguish)
|
|
224
|
+
*
|
|
225
|
+
* For special values (NaN, ±Infinity) returns 0 — callers check
|
|
226
|
+
* `isFinite()` / `isNaN()` before using `.e`.
|
|
227
|
+
*/
|
|
228
|
+
get e(): number;
|
|
229
|
+
/**
|
|
230
|
+
* Modulo (remainder after division)
|
|
231
|
+
* Result has the same sign as the dividend (this).
|
|
232
|
+
*/
|
|
233
|
+
mod(other: Scalar | BigNumber | number | string): BigNumber;
|
|
234
|
+
/**
|
|
235
|
+
* Sine of this BigNumber (in radians)
|
|
236
|
+
* Uses Taylor series: sin(x) = x - x^3/3! + x^5/5! - ...
|
|
237
|
+
*/
|
|
238
|
+
sin(): BigNumber;
|
|
239
|
+
/**
|
|
240
|
+
* Cosine of this BigNumber (in radians)
|
|
241
|
+
* Uses Taylor series: cos(x) = 1 - x^2/2! + x^4/4! - ...
|
|
242
|
+
*/
|
|
243
|
+
cos(): BigNumber;
|
|
244
|
+
/**
|
|
245
|
+
* Tangent of this BigNumber (in radians)
|
|
246
|
+
* tan(x) = sin(x) / cos(x)
|
|
247
|
+
*/
|
|
248
|
+
tan(): BigNumber;
|
|
249
|
+
/**
|
|
250
|
+
* Arcsine of this BigNumber
|
|
251
|
+
* Returns value in [-PI/2, PI/2]
|
|
252
|
+
*/
|
|
253
|
+
asin(): BigNumber;
|
|
254
|
+
/**
|
|
255
|
+
* Arccosine of this BigNumber
|
|
256
|
+
* Returns value in [0, PI]
|
|
257
|
+
*/
|
|
258
|
+
acos(): BigNumber;
|
|
259
|
+
/**
|
|
260
|
+
* Arctangent of this BigNumber
|
|
261
|
+
* Returns value in (-PI/2, PI/2)
|
|
262
|
+
* Uses Taylor series with argument reduction for convergence.
|
|
263
|
+
*/
|
|
264
|
+
atan(): BigNumber;
|
|
265
|
+
/**
|
|
266
|
+
* Two-argument arctangent: atan2(y, x)
|
|
267
|
+
* this = y, argument = x
|
|
268
|
+
* Returns angle in (-PI, PI]
|
|
269
|
+
*/
|
|
270
|
+
atan2(x: BigNumber): BigNumber;
|
|
271
|
+
/**
|
|
272
|
+
* Hyperbolic sine: sinh(x) = (e^x - e^(-x)) / 2
|
|
273
|
+
*/
|
|
274
|
+
sinh(): BigNumber;
|
|
275
|
+
/**
|
|
276
|
+
* Hyperbolic cosine: cosh(x) = (e^x + e^(-x)) / 2
|
|
277
|
+
*/
|
|
278
|
+
cosh(): BigNumber;
|
|
279
|
+
/**
|
|
280
|
+
* Hyperbolic tangent: tanh(x) = sinh(x) / cosh(x)
|
|
281
|
+
*/
|
|
282
|
+
tanh(): BigNumber;
|
|
283
|
+
/**
|
|
284
|
+
* Inverse hyperbolic sine: asinh(x) = ln(x + sqrt(x^2 + 1))
|
|
285
|
+
*/
|
|
286
|
+
asinh(): BigNumber;
|
|
287
|
+
/**
|
|
288
|
+
* Inverse hyperbolic cosine: acosh(x) = ln(x + sqrt(x^2 - 1))
|
|
289
|
+
* Domain: x >= 1
|
|
290
|
+
*/
|
|
291
|
+
acosh(): BigNumber;
|
|
292
|
+
/**
|
|
293
|
+
* Inverse hyperbolic tangent: atanh(x) = 0.5 * ln((1+x)/(1-x))
|
|
294
|
+
* Domain: -1 < x < 1
|
|
295
|
+
*/
|
|
296
|
+
atanh(): BigNumber;
|
|
297
|
+
/**
|
|
298
|
+
* Exponential function: e^x
|
|
299
|
+
* Uses Taylor series: e^x = 1 + x + x^2/2! + x^3/3! + ...
|
|
300
|
+
* With argument reduction: e^x = (e^(x/2^k))^(2^k) for faster convergence.
|
|
301
|
+
*/
|
|
302
|
+
exp(): BigNumber;
|
|
303
|
+
/**
|
|
304
|
+
* Natural logarithm: ln(x)
|
|
305
|
+
* Uses the AGM (arithmetic-geometric mean) method for fast convergence.
|
|
306
|
+
* Fallback: series ln((1+y)/(1-y)) = 2*(y + y^3/3 + y^5/5 + ...) where y = (x-1)/(x+1)
|
|
307
|
+
*/
|
|
308
|
+
ln(): BigNumber;
|
|
309
|
+
/**
|
|
310
|
+
* Base-10 logarithm: log10(x) = ln(x) / ln(10)
|
|
311
|
+
*/
|
|
312
|
+
log10(): BigNumber;
|
|
313
|
+
/**
|
|
314
|
+
* Base-2 logarithm: log2(x) = ln(x) / ln(2)
|
|
315
|
+
*/
|
|
316
|
+
log2(): BigNumber;
|
|
317
|
+
/**
|
|
318
|
+
* Cube root
|
|
319
|
+
* Uses Newton-Raphson iteration.
|
|
320
|
+
*/
|
|
321
|
+
cbrt(): BigNumber;
|
|
322
|
+
/**
|
|
323
|
+
* e^x - 1 (more precise than exp(x) - 1 for small x)
|
|
324
|
+
* Uses Taylor series directly: expm1(x) = x + x^2/2! + x^3/3! + ...
|
|
325
|
+
*/
|
|
326
|
+
expm1(): BigNumber;
|
|
327
|
+
/**
|
|
328
|
+
* ln(1 + x) (more precise than ln(1 + x) for small x)
|
|
329
|
+
*/
|
|
330
|
+
log1p(): BigNumber;
|
|
331
|
+
/**
|
|
332
|
+
* Hypotenuse: sqrt(this^2 + other^2)
|
|
333
|
+
*/
|
|
334
|
+
hypot(other: BigNumber): BigNumber;
|
|
335
|
+
/** Reduce angle to [-PI, PI] range */
|
|
336
|
+
private _reduceAngle;
|
|
337
|
+
/** Taylor series for sin(x), assumes x is in [-PI, PI] */
|
|
338
|
+
private _sinTaylor;
|
|
339
|
+
/** Taylor series for cos(x), assumes x is in [-PI, PI] */
|
|
340
|
+
private _cosTaylor;
|
|
341
|
+
/** Taylor series for atan(x), assumes |x| <= 0.5 */
|
|
342
|
+
private _atanTaylor;
|
|
343
|
+
isNaN(): boolean;
|
|
344
|
+
isFinite(): boolean;
|
|
345
|
+
isInfinite(): boolean;
|
|
346
|
+
isZero(): boolean;
|
|
347
|
+
isPositive(): boolean;
|
|
348
|
+
isNegative(): boolean;
|
|
349
|
+
isInteger(): boolean;
|
|
350
|
+
sign(): number;
|
|
351
|
+
clone(): BigNumber;
|
|
352
|
+
private ensureBigNumber;
|
|
353
|
+
private alignExponents;
|
|
354
|
+
private normalize;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Common BigNumber constants
|
|
358
|
+
*/
|
|
359
|
+
export declare const BIGNUMBER_ZERO: BigNumber;
|
|
360
|
+
export declare const BIGNUMBER_ONE: BigNumber;
|
|
361
|
+
export declare const BIGNUMBER_NEG_ONE: BigNumber;
|
|
362
|
+
export declare const BIGNUMBER_TEN: BigNumber;
|
|
363
|
+
export declare const BIGNUMBER_PI: BigNumber;
|
|
364
|
+
export declare const BIGNUMBER_E: BigNumber;
|
|
365
|
+
export declare const BIGNUMBER_LN2: BigNumber;
|
|
366
|
+
export declare const BIGNUMBER_LN10: BigNumber;
|
|
367
|
+
//# sourceMappingURL=bignumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bignumber.d.ts","sourceRoot":"","sources":["../../src/types/bignumber.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,QAAQ,EAAE,YAAY,CAAC;IACvB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,MAAM,GACN,MAA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C,KAAK,EAAE,SAAS,GAAG,SAAS,CAKjC;IAMD,sCAAsC;IACtC,OAAO,CAAC,YAAY;IAsBpB,0DAA0D;IAC1D,OAAO,CAAC,UAAU;IAoBlB,0DAA0D;IAC1D,OAAO,CAAC,UAAU;IAoBlB,oDAAoD;IACpD,OAAO,CAAC,WAAW;IAsBnB,KAAK,IAAI,OAAO,CAEf;IAED,QAAQ,IAAI,OAAO,CAElB;IAED,UAAU,IAAI,OAAO,CAEpB;IAED,MAAM,IAAI,OAAO,CAEhB;IAED,UAAU,IAAI,OAAO,CAEpB;IAED,UAAU,IAAI,OAAO,CAEpB;IAED,SAAS,IAAI,OAAO,CAGnB;IAED,IAAI,IAAI,MAAM,CAEb;IAED,KAAK,IAAI,SAAS,CAQjB;IAMD,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,SAAS;CAelB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,WAA0B,CAAC;AACtD,eAAO,MAAM,aAAa,WAA0B,CAAC;AACrD,eAAO,MAAM,iBAAiB,WAA2B,CAAC;AAC1D,eAAO,MAAM,aAAa,WAA2B,CAAC;AAGtD,eAAO,MAAM,YAAY,WAA0E,CAAC;AACpG,eAAO,MAAM,WAAW,WAA0E,CAAC;AACnG,eAAO,MAAM,aAAa,WAEzB,CAAC;AACF,eAAO,MAAM,cAAc,WAE1B,CAAC"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complex number implementation
|
|
3
|
+
* @module @danielsimonjr/mathts-core/types/complex
|
|
4
|
+
*/
|
|
5
|
+
import type { Scalar, IComplex } from './interfaces';
|
|
6
|
+
/**
|
|
7
|
+
* Check if a value is a Complex number
|
|
8
|
+
*/
|
|
9
|
+
export declare function isComplex(value: unknown): value is Complex;
|
|
10
|
+
/**
|
|
11
|
+
* Complex number class with full arithmetic support
|
|
12
|
+
* Implements the IComplex interface for type-safe complex number operations.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Complex implements IComplex {
|
|
15
|
+
readonly type = "Complex";
|
|
16
|
+
readonly re: number;
|
|
17
|
+
readonly im: number;
|
|
18
|
+
constructor(re: number, im?: number);
|
|
19
|
+
/**
|
|
20
|
+
* Create a Complex from polar form (r, θ)
|
|
21
|
+
* @param r - magnitude (radius)
|
|
22
|
+
* @param theta - angle in radians
|
|
23
|
+
*/
|
|
24
|
+
static fromPolar(r: number, theta: number): Complex;
|
|
25
|
+
/**
|
|
26
|
+
* Create a Complex from a real number
|
|
27
|
+
*/
|
|
28
|
+
static fromNumber(n: number): Complex;
|
|
29
|
+
/**
|
|
30
|
+
* Create a Complex from a JSON object
|
|
31
|
+
*/
|
|
32
|
+
static fromJSON(json: {
|
|
33
|
+
re: number;
|
|
34
|
+
im: number;
|
|
35
|
+
}): Complex;
|
|
36
|
+
/**
|
|
37
|
+
* Parse a complex number from a string
|
|
38
|
+
* Supports formats: "3+4i", "3-4i", "3", "4i", "-4i", "i", "-i"
|
|
39
|
+
*/
|
|
40
|
+
static parse(str: string): Complex;
|
|
41
|
+
/**
|
|
42
|
+
* Compare two complex numbers lexicographically (re first, then im)
|
|
43
|
+
* @returns -1, 0, or 1
|
|
44
|
+
*/
|
|
45
|
+
static compare(a: Complex, b: Complex): number;
|
|
46
|
+
valueOf(): number;
|
|
47
|
+
toString(): string;
|
|
48
|
+
toJSON(): {
|
|
49
|
+
mathjs: string;
|
|
50
|
+
re: number;
|
|
51
|
+
im: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Return polar representation
|
|
55
|
+
*/
|
|
56
|
+
toPolar(): {
|
|
57
|
+
r: number;
|
|
58
|
+
phi: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Format with options (precision, notation, etc.)
|
|
62
|
+
*/
|
|
63
|
+
format(options?: {
|
|
64
|
+
precision?: number;
|
|
65
|
+
notation?: 'fixed' | 'exponential' | 'auto';
|
|
66
|
+
}): string;
|
|
67
|
+
/**
|
|
68
|
+
* Complex conjugate (a + bi → a - bi)
|
|
69
|
+
*/
|
|
70
|
+
conjugate(): Complex;
|
|
71
|
+
/**
|
|
72
|
+
* Magnitude (absolute value) |z| = √(re² + im²)
|
|
73
|
+
*/
|
|
74
|
+
abs(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Phase angle (argument) in radians, range (-π, π]
|
|
77
|
+
*/
|
|
78
|
+
arg(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Squared magnitude |z|² = re² + im²
|
|
81
|
+
* More efficient than abs() when you don't need the square root
|
|
82
|
+
*/
|
|
83
|
+
abs2(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Addition: (a + bi) + (c + di) = (a + c) + (b + d)i
|
|
86
|
+
*/
|
|
87
|
+
add(other: Scalar): Complex;
|
|
88
|
+
/**
|
|
89
|
+
* Subtraction: (a + bi) - (c + di) = (a - c) + (b - d)i
|
|
90
|
+
*/
|
|
91
|
+
subtract(other: Scalar): Complex;
|
|
92
|
+
/**
|
|
93
|
+
* Multiplication: (a + bi)(c + di) = (ac - bd) + (ad + bc)i
|
|
94
|
+
*/
|
|
95
|
+
multiply(other: Scalar): Complex;
|
|
96
|
+
/**
|
|
97
|
+
* Division: (a + bi)/(c + di) = ((ac + bd) + (bc - ad)i) / (c² + d²)
|
|
98
|
+
*/
|
|
99
|
+
divide(other: Scalar): Complex;
|
|
100
|
+
sub(other: Scalar): Complex;
|
|
101
|
+
mul(other: Scalar): Complex;
|
|
102
|
+
div(other: Scalar): Complex;
|
|
103
|
+
neg(): Complex;
|
|
104
|
+
/**
|
|
105
|
+
* Negation: -(a + bi) = -a - bi
|
|
106
|
+
*/
|
|
107
|
+
negate(): Complex;
|
|
108
|
+
/**
|
|
109
|
+
* Multiplicative inverse: 1/z = z̄/|z|²
|
|
110
|
+
*/
|
|
111
|
+
inverse(): Complex;
|
|
112
|
+
/**
|
|
113
|
+
* Square root using the principal branch (Re ≥ 0; Im has the sign of `this.im`).
|
|
114
|
+
*
|
|
115
|
+
* Algebraic form, not polar: one hypot + one sqrt instead of hypot + atan2 +
|
|
116
|
+
* cos + sin. Same branch cut as C99 / the previous polar implementation,
|
|
117
|
+
* including `sqrt(-x - 0i) = −√x · i`.
|
|
118
|
+
*/
|
|
119
|
+
sqrt(): Complex;
|
|
120
|
+
/**
|
|
121
|
+
* n-th root (returns principal root)
|
|
122
|
+
*/
|
|
123
|
+
nthRoot(n: number): Complex;
|
|
124
|
+
/**
|
|
125
|
+
* All n-th roots
|
|
126
|
+
*/
|
|
127
|
+
nthRoots(n: number): Complex[];
|
|
128
|
+
/**
|
|
129
|
+
* Exponential: e^(a+bi) = e^a · (cos(b) + i·sin(b))
|
|
130
|
+
*/
|
|
131
|
+
exp(): Complex;
|
|
132
|
+
/**
|
|
133
|
+
* Natural logarithm: ln(z) = ln|z| + i·arg(z)
|
|
134
|
+
*/
|
|
135
|
+
log(): Complex;
|
|
136
|
+
/**
|
|
137
|
+
* Logarithm base 10
|
|
138
|
+
*/
|
|
139
|
+
log10(): Complex;
|
|
140
|
+
/**
|
|
141
|
+
* Logarithm base 2
|
|
142
|
+
*/
|
|
143
|
+
log2(): Complex;
|
|
144
|
+
/**
|
|
145
|
+
* Power: z^w = e^(w·ln(z))
|
|
146
|
+
*/
|
|
147
|
+
pow(n: number | Complex): Complex;
|
|
148
|
+
/**
|
|
149
|
+
* Sine: sin(a + bi) = sin(a)cosh(b) + i·cos(a)sinh(b)
|
|
150
|
+
*/
|
|
151
|
+
sin(): Complex;
|
|
152
|
+
/**
|
|
153
|
+
* Cosine: cos(a + bi) = cos(a)cosh(b) - i·sin(a)sinh(b)
|
|
154
|
+
*/
|
|
155
|
+
cos(): Complex;
|
|
156
|
+
/**
|
|
157
|
+
* Tangent: tan(x+iy) = (sin 2x + i sinh 2y) / (cos 2x + cosh 2y)
|
|
158
|
+
*
|
|
159
|
+
* Closed form — no intermediate `sin`/`cos` Complex allocations.
|
|
160
|
+
*/
|
|
161
|
+
tan(): Complex;
|
|
162
|
+
/**
|
|
163
|
+
* Cotangent: cot(x+iy) = (sin 2x − i sinh 2y) / (cosh 2y − cos 2x)
|
|
164
|
+
*/
|
|
165
|
+
cot(): Complex;
|
|
166
|
+
/**
|
|
167
|
+
* Secant: sec(z) = 1 / cos(z)
|
|
168
|
+
*/
|
|
169
|
+
sec(): Complex;
|
|
170
|
+
/**
|
|
171
|
+
* Cosecant: csc(z) = 1 / sin(z)
|
|
172
|
+
*/
|
|
173
|
+
csc(): Complex;
|
|
174
|
+
/**
|
|
175
|
+
* Hyperbolic sine: sinh(z) = (e^z - e^(-z)) / 2
|
|
176
|
+
*/
|
|
177
|
+
sinh(): Complex;
|
|
178
|
+
/**
|
|
179
|
+
* Hyperbolic cosine: cosh(z) = (e^z + e^(-z)) / 2
|
|
180
|
+
*/
|
|
181
|
+
cosh(): Complex;
|
|
182
|
+
/**
|
|
183
|
+
* Hyperbolic tangent: tanh(x+iy) = (sinh 2x + i sin 2y) / (cosh 2x + cos 2y)
|
|
184
|
+
*/
|
|
185
|
+
tanh(): Complex;
|
|
186
|
+
/**
|
|
187
|
+
* Hyperbolic cotangent: coth(x+iy) = (sinh 2x − i sin 2y) / (cosh 2x − cos 2y)
|
|
188
|
+
*/
|
|
189
|
+
coth(): Complex;
|
|
190
|
+
/**
|
|
191
|
+
* Hyperbolic secant: sech(z) = 1 / cosh(z)
|
|
192
|
+
*/
|
|
193
|
+
sech(): Complex;
|
|
194
|
+
/**
|
|
195
|
+
* Hyperbolic cosecant: csch(z) = 1 / sinh(z)
|
|
196
|
+
*/
|
|
197
|
+
csch(): Complex;
|
|
198
|
+
/**
|
|
199
|
+
* Arc sine: asin(z) = -i·ln(iz + √(1 - z²))
|
|
200
|
+
*/
|
|
201
|
+
asin(): Complex;
|
|
202
|
+
/**
|
|
203
|
+
* Arc cosine: acos(z) = π/2 - asin(z)
|
|
204
|
+
*/
|
|
205
|
+
acos(): Complex;
|
|
206
|
+
/**
|
|
207
|
+
* Arc tangent: atan(z) = (i/2)·ln((i + z)/(i - z))
|
|
208
|
+
*/
|
|
209
|
+
atan(): Complex;
|
|
210
|
+
/**
|
|
211
|
+
* Inverse hyperbolic sine: asinh(z) = ln(z + √(z² + 1))
|
|
212
|
+
*/
|
|
213
|
+
asinh(): Complex;
|
|
214
|
+
/**
|
|
215
|
+
* Inverse hyperbolic cosine: acosh(z) = ln(z + √(z-1)·√(z+1))
|
|
216
|
+
*
|
|
217
|
+
* The principal value has non-negative real part (C99 Annex G / DLMF 4.37 /
|
|
218
|
+
* NumPy convention). Using the factored `√(z-1)·√(z+1)` rather than `√(z²-1)`
|
|
219
|
+
* selects the correct Riemann sheet for Re(z) < 0 and on the real-axis branch
|
|
220
|
+
* cuts (z < 1), where `√(z²-1)` lands on the wrong branch — the previous form
|
|
221
|
+
* returned a negative real part (e.g. acosh(-1+0.5i)) and the wrong sign of π
|
|
222
|
+
* on z < -1.
|
|
223
|
+
*/
|
|
224
|
+
acosh(): Complex;
|
|
225
|
+
/**
|
|
226
|
+
* Inverse hyperbolic tangent: atanh(z) = (1/2)·ln((1 + z)/(1 - z))
|
|
227
|
+
*/
|
|
228
|
+
atanh(): Complex;
|
|
229
|
+
/**
|
|
230
|
+
* Check equality within tolerance
|
|
231
|
+
*/
|
|
232
|
+
equals(other: Complex, epsilon?: number): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Check if this is a real number (im ≈ 0)
|
|
235
|
+
*/
|
|
236
|
+
isReal(epsilon?: number): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Check if this is purely imaginary (re ≈ 0, im ≠ 0)
|
|
239
|
+
*/
|
|
240
|
+
isImaginary(epsilon?: number): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Check if this is zero
|
|
243
|
+
*/
|
|
244
|
+
isZero(epsilon?: number): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Check if this is NaN
|
|
247
|
+
*/
|
|
248
|
+
isNaN(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Check if this is infinite
|
|
251
|
+
*/
|
|
252
|
+
isInfinite(): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Clone this complex number
|
|
255
|
+
*/
|
|
256
|
+
clone(): Complex;
|
|
257
|
+
/**
|
|
258
|
+
* Round real and imaginary parts to specified decimals
|
|
259
|
+
*/
|
|
260
|
+
round(decimals?: number): Complex;
|
|
261
|
+
/**
|
|
262
|
+
* Floor real and imaginary parts
|
|
263
|
+
*/
|
|
264
|
+
floor(): Complex;
|
|
265
|
+
/**
|
|
266
|
+
* Ceil real and imaginary parts
|
|
267
|
+
*/
|
|
268
|
+
ceil(): Complex;
|
|
269
|
+
/**
|
|
270
|
+
* Sign function: z / |z| (unit complex number in same direction)
|
|
271
|
+
*/
|
|
272
|
+
sign(): Complex;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Imaginary unit constant: i = √(-1)
|
|
276
|
+
*/
|
|
277
|
+
export declare const I: Complex;
|
|
278
|
+
/**
|
|
279
|
+
* Common constants
|
|
280
|
+
*/
|
|
281
|
+
export declare const COMPLEX_ZERO: Complex;
|
|
282
|
+
export declare const COMPLEX_ONE: Complex;
|
|
283
|
+
export declare const COMPLEX_NEG_ONE: Complex;
|
|
284
|
+
//# sourceMappingURL=complex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../src/types/complex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAwBD;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,YAAY,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