@danielsimonjr/mathts-core 0.1.4 → 0.1.5
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/index.d.ts +7 -0
- package/dist/index.js +34 -0
- package/package.json +55 -55
package/dist/index.d.ts
CHANGED
|
@@ -243,6 +243,10 @@ declare class Complex implements IComplex {
|
|
|
243
243
|
* Division: (a + bi)/(c + di) = ((ac + bd) + (bc - ad)i) / (c² + d²)
|
|
244
244
|
*/
|
|
245
245
|
divide(other: Scalar): Complex;
|
|
246
|
+
sub(other: Scalar): Complex;
|
|
247
|
+
mul(other: Scalar): Complex;
|
|
248
|
+
div(other: Scalar): Complex;
|
|
249
|
+
neg(): Complex;
|
|
246
250
|
/**
|
|
247
251
|
* Negation: -(a + bi) = -a - bi
|
|
248
252
|
*/
|
|
@@ -502,6 +506,9 @@ declare class Fraction implements IFraction {
|
|
|
502
506
|
* Division: a/b ÷ c/d = ad / bc
|
|
503
507
|
*/
|
|
504
508
|
divide(other: Scalar): Fraction;
|
|
509
|
+
mul(other: Scalar): Fraction;
|
|
510
|
+
sub(other: Scalar): Fraction;
|
|
511
|
+
div(other: Scalar): Fraction;
|
|
505
512
|
/**
|
|
506
513
|
* Negation: -(a/b) = -a/b
|
|
507
514
|
*/
|
package/dist/index.js
CHANGED
|
@@ -217,6 +217,27 @@ var Complex = class _Complex {
|
|
|
217
217
|
}
|
|
218
218
|
return new _Complex(this.re / n, this.im / n);
|
|
219
219
|
}
|
|
220
|
+
// ------------------------------------------------------------
|
|
221
|
+
// Short-name aliases (mathjs-functions calling convention)
|
|
222
|
+
//
|
|
223
|
+
// The functions-package typed-function arithmetic (subtractScalar,
|
|
224
|
+
// multiplyScalar, divideScalar, …) invokes `.add/.sub/.mul/.div/.neg`
|
|
225
|
+
// on scalars. A core Complex (e.g. produced by `sqrt(-4)`) can flow into
|
|
226
|
+
// those code paths, so it must answer to the short names too — otherwise
|
|
227
|
+
// `x.sub is not a function`. Mirrors the Fraction short-alias fix.
|
|
228
|
+
// ------------------------------------------------------------
|
|
229
|
+
sub(other) {
|
|
230
|
+
return this.subtract(other);
|
|
231
|
+
}
|
|
232
|
+
mul(other) {
|
|
233
|
+
return this.multiply(other);
|
|
234
|
+
}
|
|
235
|
+
div(other) {
|
|
236
|
+
return this.divide(other);
|
|
237
|
+
}
|
|
238
|
+
neg() {
|
|
239
|
+
return this.negate();
|
|
240
|
+
}
|
|
220
241
|
/**
|
|
221
242
|
* Negation: -(a + bi) = -a - bi
|
|
222
243
|
*/
|
|
@@ -773,6 +794,19 @@ var Fraction = class _Fraction {
|
|
|
773
794
|
}
|
|
774
795
|
return this.divide(_Fraction.fromNumber(Number(other.valueOf())));
|
|
775
796
|
}
|
|
797
|
+
// Short-name aliases (mathjs Fraction API). Ported mathjs functions such as
|
|
798
|
+
// multiplyScalar/subtractScalar/divideScalar call x.mul/x.sub/x.div; without
|
|
799
|
+
// these, mixed number/Fraction dispatch (e.g. affine unit conversion like
|
|
800
|
+
// celsius→fahrenheit) threw "x.mul is not a function".
|
|
801
|
+
mul(other) {
|
|
802
|
+
return this.multiply(other);
|
|
803
|
+
}
|
|
804
|
+
sub(other) {
|
|
805
|
+
return this.subtract(other);
|
|
806
|
+
}
|
|
807
|
+
div(other) {
|
|
808
|
+
return this.divide(other);
|
|
809
|
+
}
|
|
776
810
|
/**
|
|
777
811
|
* Negation: -(a/b) = -a/b
|
|
778
812
|
*/
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@danielsimonjr/mathts-core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Core types, utilities, and configuration for MathTS",
|
|
5
|
-
"author": "Daniel Simon Jr.",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./dist/index.js",
|
|
9
|
-
"module": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
23
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"test:watch": "vitest",
|
|
26
|
-
"test:coverage": "vitest run --coverage",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"lint": "eslint src --ext .ts",
|
|
29
|
-
"lint:fix": "eslint src --ext .ts --fix",
|
|
30
|
-
"clean": "rm -rf dist",
|
|
31
|
-
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"typed-function": "github:danielsimonjr/typed-function"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@types/node": "^25.5.2",
|
|
38
|
-
"tsup": "^8.0.0",
|
|
39
|
-
"typescript": "^5.3.0",
|
|
40
|
-
"vitest": "^4.1.5"
|
|
41
|
-
},
|
|
42
|
-
"publishConfig": {
|
|
43
|
-
"access": "public"
|
|
44
|
-
},
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "https://github.com/danielsimonjr/mathts",
|
|
48
|
-
"directory": "core"
|
|
49
|
-
},
|
|
50
|
-
"keywords": [
|
|
51
|
-
"math",
|
|
52
|
-
"typescript",
|
|
53
|
-
"core"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@danielsimonjr/mathts-core",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Core types, utilities, and configuration for MathTS",
|
|
5
|
+
"author": "Daniel Simon Jr.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
23
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:coverage": "vitest run --coverage",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint src --ext .ts",
|
|
29
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
30
|
+
"clean": "rm -rf dist",
|
|
31
|
+
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"typed-function": "github:danielsimonjr/typed-function"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^25.5.2",
|
|
38
|
+
"tsup": "^8.0.0",
|
|
39
|
+
"typescript": "^5.3.0",
|
|
40
|
+
"vitest": "^4.1.5"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/danielsimonjr/mathts",
|
|
48
|
+
"directory": "core"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"math",
|
|
52
|
+
"typescript",
|
|
53
|
+
"core"
|
|
54
|
+
]
|
|
55
|
+
}
|