@zushah/chalkboard 2.2.0 → 2.4.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/CHANGELOG.md +44 -2
- package/README.md +15 -13
- package/dist/Chalkboard.d.ts +95 -40
- package/dist/Chalkboard.d.ts.map +1 -1
- package/dist/Chalkboard.js +2550 -709
- package/dist/Chalkboard.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,48 @@
|
|
|
1
1
|
# Chalkboard changelog
|
|
2
2
|
All notable changes of every update of the Chalkboard library are recorded in this file.
|
|
3
3
|
|
|
4
|
-
## [v2.
|
|
4
|
+
## [v2.4.0 Noether](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.4.0) - 04/28/2025
|
|
5
|
+
The fourteenth release of the Chalkboard library.
|
|
6
|
+
Commits: [`v2.3.0...v2.4.0`](https://www.github.com/Zushah/Chalkboard/compare/v2.3.0...v2.4.0)
|
|
7
|
+
- Added `vect.modeConfig` which can change the input/output mode of the `vect` commands so that they can accept and return vectors (`"vector"` mode, which is the default), arrays (`"array"` mode), typed arrays (`"float32array"` or `"float64array"` modes), matrices (`"matrix"` mode), strings (`"string"` mode), or JSON strings (`"json"` mode)
|
|
8
|
+
- Added `abal.monoid`, `abal.isMonoid`, and `abal.isSubmonoid` which defines and checks for the algebraic structures known as monoids
|
|
9
|
+
- Added `abal.toTypedArray`, `comp.toTypedArray`, `matr.toTypedArray`, `quat.toTypedArray`, `tens.toTypedArray` and `vect.toTypedArray` which convert sets, structures, complex numbers, matrices, quaternions, tensors, and vectors to six different possible typed arrays
|
|
10
|
+
- Added `real.zero` which defines a zero function of a specified type
|
|
11
|
+
- Removed `comp.zero` and `quat.zero` because they were redundant as `comp.init` and `quat.init` already have their feature
|
|
12
|
+
- Changed `trig.cos` and `trig.sin` to be roughly ten times faster
|
|
13
|
+
- Changed `abal.group`, `abal.ring`, and `abal.field` to no longer use presets for sets and operations
|
|
14
|
+
- Changed `abal.isSubset`, `abal.isSubgroup`, `abal.isSubring`, and `abal.isSubfield` to be able to work with infinite sets
|
|
15
|
+
- Changed `abal.isClosed`, `abal.isEqual`, and `abal.direct` to be able to work with monoids
|
|
16
|
+
- Changed `bool.modeConfig` to be able to work case-insensitively
|
|
17
|
+
- Changed `matr.zero` and `tens.zero` to input the size of the zero matrix or tensor directly instead of inputting another matrix or tensor
|
|
18
|
+
- Changed all of the `vect` commands to work with the new `vect.modeConfig` feature
|
|
19
|
+
- Changed `APPLY` and some of the `calc`, `matr`, `quat`, and `real` commands to work with the new `vect.modeConfig` feature
|
|
20
|
+
- Changed all of the `plot` commands to work with the new `plot.getContext` fix
|
|
21
|
+
- Fixed `plot.PARSED_CONTEXT` by replacing it with `plot.getContext` as it was throwing false errors when no HTML `<canvas>` element was available even if the `plot` commands weren't in use
|
|
22
|
+
- Fixed `numb.isRational` which was giving inaccurate results because it was able to turn any floating-point number into a fraction even if it's mathematically inaccurate
|
|
23
|
+
|
|
24
|
+
## [v2.3.0 Boole](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.3.0) - 04/14/2025
|
|
25
|
+
The thirteenth release of the Chalkboard library.
|
|
26
|
+
Commits: [`v2.2.0...v2.3.0`](https://www.github.com/Zushah/Chalkboard/compare/v2.2.0...v2.3.0)
|
|
27
|
+
- Added `I` which calculates the number i
|
|
28
|
+
- Added boolean algebra functionalities with the new `bool` category containing 23 commands, which are mentioned below
|
|
29
|
+
- Added `bool.AND`, `bool.OR`, `bool.XOR`, `bool.COND`, `bool.CONV`, `bool.BICOND`, `bool.NOT`, `bool.NAND`, `bool.NOR`, `bool.NCOND`, `bool.NCONV`, and `bool.NBICOND` which are boolean operations that act on two or more values
|
|
30
|
+
- Added `bool.parse` which evaluates or simplifies a boolean expression, `bool.minimize` which minimizes a boolean expression, and `bool.isEqual` which checks if two boolean expressions are logically equivalent
|
|
31
|
+
- Added `bool.truthTable` which calculates the truth table for one or more boolean operators
|
|
32
|
+
- Added `bool.Karnaugh` which defines the Karnaugh map (or K-map) for a boolean expression and `bool.mapping` which defines a function that maps inputs to outputs based on truth tables
|
|
33
|
+
- Added `bool.primeImplicants` which calculates the prime implicants of a boolean expression using its Karnaugh map
|
|
34
|
+
- Added `bool.toCNF` which converts a boolean expression to conjunctive normal form and `bool.toDNF` which converts a boolean expression to disjunctive normal form
|
|
35
|
+
- Added `bool.modeConfig` which can change the mode of the `bool` commands to output either `1`/`0` (which is `"binary"` mode) or `true`/`false` (which is `"boolean"` mode)
|
|
36
|
+
- Added `numb.toBinary`, `numb.toHexadecimal`, and `numb.toOctal` which convert numbers from decimal representation to binary, hexadecimal, or octal representations
|
|
37
|
+
- Added `numb.toDecimal` which converts a number from another representation back to decimal representation
|
|
38
|
+
- Added `real.absolute`, `real.add`, `real.compose`, `real.div`, `real.mul`, `real.negate`, `real.pow` `real.reciprocate`, `real.scl`, `real.sub`, and `real.translate` which calculate the absolute value of a function, the addition of two functions, the composition of two functions, the division of two functions, the multiplication of two functions, the negation of a function, the exponentation of a function, the reciprocation of a function, the scalar multiplication of a function, the subtraction of two functions, and the translation of a function, respectively
|
|
39
|
+
- Added `real.polynomial` which defines a polynomial function based on inputted coefficients, and added `real.randomPolynomial` which defines a polynomial of a specified degree with random coefficients
|
|
40
|
+
- Changed `real.define` to be written more efficiently
|
|
41
|
+
- Changed `stat.random` to have its first parameter be the length of the array instead of the last
|
|
42
|
+
- Fixed `comp.pow`, `matr.norm`, `matr.normsq`, `plot.definition`, and `stat.regression` which were throwing type errors because of the updated `real.pow` function which can now handle not only numbers but also functions
|
|
43
|
+
- Fixed `comp.zero`, `quat.zero`, and `vect.zero` which were unnecessarily using erasing operations
|
|
44
|
+
|
|
45
|
+
## [v2.2.0 Galois](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.2.0) - 04/07/2025
|
|
5
46
|
The twelfth release of the Chalkboard library.
|
|
6
47
|
Commits: [`v2.1.0...v2.2.0`](https://www.github.com/Zushah/Chalkboard/compare/v2.1.0...v2.2.0)
|
|
7
48
|
- Added abstract algebra functionalities with the new `abal` category containing 76 commands, so only a few notable ones are mentioned below
|
|
@@ -42,6 +83,7 @@ Commits: [`v2.1.0...v2.2.0`](https://www.github.com/Zushah/Chalkboard/compare/v2
|
|
|
42
83
|
- Fixed `matr.resize` which was always returning zero matrices
|
|
43
84
|
- Fixed `matr.zero` which was unnecessarily using erasing operations
|
|
44
85
|
- Fixed `tens.init` which had an expression assigned to itself
|
|
86
|
+
- Fixed `geom.rectangularprismA` thanks to @gyang0's contribution [here](https://github.com/Zushah/Chalkboard/pull/5)
|
|
45
87
|
|
|
46
88
|
## [v2.1.0 Seki](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.1.0) - 01/22/2024
|
|
47
89
|
The eleventh release of the Chalkboard library.
|
|
@@ -248,4 +290,4 @@ Commits: [`v1.0.0...v1.1.0`](https://www.github.com/Zushah/Chalkboard/compare/v1
|
|
|
248
290
|
|
|
249
291
|
## [v1.0.0 Euclid](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.0.0) - 11/06/2023
|
|
250
292
|
The first release of the Chalkboard library.
|
|
251
|
-
Commits: [`v1.0.0...main`](https://www.github.com/Zushah/Chalkboard/compare/v1.0.0...main)
|
|
293
|
+
Commits: [`v1.0.0...main`](https://www.github.com/Zushah/Chalkboard/compare/v1.0.0...main)
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align="center"><a href="https://www.github.com/Zushah/Chalkboard"><img src="https://raw.githubusercontent.com/Zushah/Chalkboard/main/assets/Chalkboard-logo.png" width="50%"></a></p>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<a href="https://www.github.com/Zushah/Chalkboard/releases/tag/v2.
|
|
4
|
-
<a href="https://www.
|
|
5
|
-
<a href="https://
|
|
3
|
+
<a href="https://www.github.com/Zushah/Chalkboard/releases/tag/v2.4.0"><img src="https://img.shields.io/badge/release-v2.4.0_Noether-blueviolet?logo=github&logoColor=white" alt="Latest release"></a>
|
|
4
|
+
<a href="https://www.github.com/microsoft/TypeScript"><img src="https://img.shields.io/github/languages/top/Zushah/Chalkboard?color=blue&logo=typescript&logoColor=white" alt="Written in TypeScript"></a>
|
|
5
|
+
<a href="https://www.codefactor.io/repository/github/zushah/chalkboard"><img src="https://img.shields.io/codefactor/grade/github/Zushah/Chalkboard?color=darkgreen&logo=codefactor&logoColor=white" alt="CodeFactor grade"></a>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@zushah/chalkboard"><img src="https://img.shields.io/npm/dm/%40zushah/chalkboard?logo=npm&logoColor=white" alt="npm downloads"></a>
|
|
7
7
|
<a href="https://www.github.com/Zushah/Chalkboard/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/Zushah/Chalkboard?color=yellow&logo=opensourceinitiative&logoColor=white" alt="MIT License"></a>
|
|
8
|
-
<a href="https://
|
|
8
|
+
<a href="https://bundlephobia.com/package/@zushah/chalkboard@2.4.0"><img src="https://img.shields.io/bundlephobia/min/%40zushah/chalkboard?color=orange&logo=files&logoColor=white" alt="Minified size"></a>
|
|
9
9
|
<a href="https://www.jsdelivr.com/package/gh/Zushah/Chalkboard"><img src="https://img.shields.io/jsdelivr/gh/hm/Zushah/Chalkboard?color=crimson&logo=jsdelivr&logoColor=white" alt="jsDelivr requests"></a>
|
|
10
10
|
<br>
|
|
11
11
|
<a href="https://zushah.github.io/Chalkboard">https://zushah.github.io/Chalkboard</a>
|
|
@@ -23,29 +23,30 @@
|
|
|
23
23
|
</ol>
|
|
24
24
|
|
|
25
25
|
# About
|
|
26
|
-
The Chalkboard library is a JavaScript namespace that provides a plethora of both practical and abstract mathematical functionalities for its user. It was developed by [Zushah](https://www.github.com/Zushah) during 2022 and 2023 and then [released](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.0.0) on November 6, 2023. As per the latest release of [v2.
|
|
26
|
+
The Chalkboard library is a JavaScript namespace that provides a plethora of both practical and abstract mathematical functionalities for its user. It was developed by [Zushah](https://www.github.com/Zushah) during 2022 and 2023 and then [released](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.0.0) on November 6, 2023. As per the latest release of [v2.4.0 Noether](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.4.0), Chalkboard has 615 unique commands. The library is available for regular JavaScript on both the client-side and the server-side as well as [Proccesing.js](https://www.processing.org/) (fully compatible with [Khan Academy](https://www.khanacademy.org/cs/chalkboard/6708642430369792)). Chalkboard's website can be visited [here](https://zushah.github.io/Chalkboard).
|
|
27
27
|
|
|
28
28
|
# Installation
|
|
29
29
|
If your JavaScript project is being run on the client-side within a webpage, you can install Chalkboard with this HTML tag:
|
|
30
30
|
```html
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/gh/Zushah/Chalkboard@2.
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/gh/Zushah/Chalkboard@2.4.0/dist/Chalkboard.min.js"></script>
|
|
32
32
|
```
|
|
33
33
|
If your JavaScript project is being run on the server-side within the [Node.js](https://nodejs.org/en) environment, you can install Chalkboard with this console command:
|
|
34
34
|
```bash
|
|
35
35
|
npm install @zushah/chalkboard
|
|
36
36
|
```
|
|
37
|
-
Alternatively, you can simply download the [latest release](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.
|
|
37
|
+
Alternatively, you can simply download the [latest release](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.4.0) and put the relevant files in your project's directory.
|
|
38
38
|
|
|
39
39
|
Chalkboard can also be downloaded on [Khan Academy](https://www.khanacademy.org) from the code in the corresponding [release](https://www.khanacademy.org/cs/chalkboard/6708642430369792).
|
|
40
40
|
|
|
41
41
|
# Documentation
|
|
42
|
-
Chalkboard has
|
|
42
|
+
Chalkboard has fourteen categories of commands:
|
|
43
43
|
- `abal` - Abstract algebra definitions, sets, operations, structures, and morphisms
|
|
44
|
+
- `bool` - Boolean algebra operations
|
|
44
45
|
- `calc` - Single/multi-variable real/complex-valued calculus operations
|
|
45
46
|
- `comp` - Complex number and complex function operations
|
|
46
47
|
- `geom` - Geometric operations
|
|
47
48
|
- `matr` - Multidimensional matrix operations
|
|
48
|
-
- `numb` - Number-
|
|
49
|
+
- `numb` - Number-theoretic operations
|
|
49
50
|
- `plot` - Plotting real and complex functions, complex numbers, vectors, matrices, and statistical graphs
|
|
50
51
|
- `quat` - Quaternion operations
|
|
51
52
|
- `real` - Real number and real function operations
|
|
@@ -54,10 +55,11 @@ Chalkboard has thirteen categories of commands:
|
|
|
54
55
|
- `trig` - Trigonometric function operations
|
|
55
56
|
- `vect` - Two-, three-, and four-dimensional vector and vector field operations
|
|
56
57
|
|
|
57
|
-
There are also
|
|
58
|
+
There are also nine "global" commands and constants, which are:
|
|
58
59
|
- `APPLY` - Applies a callback function in an element-wise manner on a Chalkboard object
|
|
59
60
|
- `CONTEXT` - The JavaScript canvas rendering context to use for plotting
|
|
60
61
|
- `E()` - Computes the number e
|
|
62
|
+
- `I()` - Computes the number i
|
|
61
63
|
- `LOGO()` - Draws the Chalkboard logo
|
|
62
64
|
- `PARSEPREFIX` - Used for adding custom functions to the Chalkboard parser
|
|
63
65
|
- `PI()` - Computes the number π
|
|
@@ -147,9 +149,9 @@ const factorialt = cb.APPLY(t, (x) => cb.numb.factorial(x)); // Calculates the f
|
|
|
147
149
|
|
|
148
150
|
const Z4 = cb.abal.Z(4); // The set of integers modulo 4 is the set {0, 1, 2, 3}
|
|
149
151
|
const C4 = cb.abal.C(4); // The set of fourth roots of unity is the set {1, i, -1, -i}
|
|
150
|
-
const G = cb.abal.group(Z4, (a, b) => (a + b) % 4); // The group G is the set
|
|
151
|
-
const H = cb.abal.group(C4, (z, w) => cb.comp.mul(z, w)); // The group H is the set
|
|
152
|
-
const F = cb.abal.isomorphism(G, H, (n) => cb.comp.round(cb.comp.pow(cb.comp.init(0, 1), n))); // The isomorphism F: G → H is defined by F(n) = i
|
|
152
|
+
const G = cb.abal.group(Z4, (a, b) => (a + b) % 4); // The group G is the set Z₄ with mod 4 addition
|
|
153
|
+
const H = cb.abal.group(C4, (z, w) => cb.comp.mul(z, w)); // The group H is the set C₄ with complex multiplication
|
|
154
|
+
const F = cb.abal.isomorphism(G, H, (n) => cb.comp.round(cb.comp.pow(cb.comp.init(0, 1), n))); // The isomorphism F: G → H is defined by F(n) = iⁿ for all n in Z₄
|
|
153
155
|
```
|
|
154
156
|
Several examples that are rather interesting can be seen [here](https://zushah.github.io/Chalkboard/examples/index.html), and their source code is [here](https://www.github.com/Zushah/Chalkboard/tree/main/examples).
|
|
155
157
|
|
package/dist/Chalkboard.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ type ChalkboardVector = {
|
|
|
50
50
|
y: number;
|
|
51
51
|
z?: number;
|
|
52
52
|
w?: number;
|
|
53
|
-
};
|
|
53
|
+
} | number[] | Float32Array | Float64Array | ChalkboardMatrix | string;
|
|
54
54
|
type ChalkboardVectorField = {
|
|
55
55
|
p: string;
|
|
56
56
|
q: string;
|
|
@@ -61,12 +61,13 @@ declare namespace Chalkboard {
|
|
|
61
61
|
const APPLY: <T>(object: ChalkboardComplex | ChalkboardMatrix | ChalkboardQuaternion | ChalkboardTensor | ChalkboardVector | ChalkboardSet<T> | ChalkboardStructure<T>, callback: (x: any) => any) => ChalkboardComplex | ChalkboardMatrix | ChalkboardQuaternion | ChalkboardTensor | ChalkboardVector | ChalkboardSet<T> | ChalkboardStructure<T>;
|
|
62
62
|
let CONTEXT: string;
|
|
63
63
|
const E: (exponent?: number) => number;
|
|
64
|
+
const I: (exponent?: number) => ChalkboardComplex;
|
|
64
65
|
const LOGO: (x?: number, y?: number, size?: number, context?: CanvasRenderingContext2D) => void;
|
|
65
66
|
let PARSEPREFIX: string;
|
|
66
67
|
const PI: (coefficient?: number) => number;
|
|
67
68
|
const README: () => void;
|
|
68
|
-
const VERSION: "2.
|
|
69
|
-
const VERSIONALIAS: "
|
|
69
|
+
const VERSION: "2.4.0";
|
|
70
|
+
const VERSIONALIAS: "Noether";
|
|
70
71
|
}
|
|
71
72
|
declare namespace Chalkboard {
|
|
72
73
|
namespace abal {
|
|
@@ -97,7 +98,7 @@ declare namespace Chalkboard {
|
|
|
97
98
|
const invmorphism: <T, U>(morph: ChalkboardMorphism<T, U>) => ChalkboardMorphism<U, T>;
|
|
98
99
|
const isAutomorphism: <T>(morph: ChalkboardMorphism<T, T>) => boolean;
|
|
99
100
|
const isBijective: <T, U>(morph: ChalkboardMorphism<T, U>) => boolean;
|
|
100
|
-
const isClosed: <T>(set: ChalkboardSet<T
|
|
101
|
+
const isClosed: <T>(set: ChalkboardSet<T>, operation: (a: T, b: T) => T) => boolean;
|
|
101
102
|
const isCommutative: <T>(struc: ChalkboardStructure<T>) => boolean;
|
|
102
103
|
const isCyclicSubgroup: <T>(group: ChalkboardStructure<T>, subgroup: ChalkboardSet<T>) => boolean;
|
|
103
104
|
const isEmpty: <T>(struc: ChalkboardSet<T> | ChalkboardStructure<T>) => boolean;
|
|
@@ -112,12 +113,14 @@ declare namespace Chalkboard {
|
|
|
112
113
|
const isInjective: <T, U>(morph: ChalkboardMorphism<T, U>) => boolean;
|
|
113
114
|
const isInverse: <T>(struc: ChalkboardStructure<T>, element1: T, element2: T, type?: "add" | "mul") => boolean;
|
|
114
115
|
const isIsomorphism: <T, U>(morph: ChalkboardMorphism<T, U>) => boolean;
|
|
116
|
+
const isMonoid: <T>(monoid: ChalkboardStructure<T>) => boolean;
|
|
115
117
|
const isNormalSubgroup: <T>(group: ChalkboardStructure<T>, subgroup: ChalkboardSet<T>) => boolean;
|
|
116
118
|
const isomorphism: <T, U>(struc1: ChalkboardStructure<T>, struc2: ChalkboardStructure<U>, mapping: (element: T) => U) => ChalkboardMorphism<T, U>;
|
|
117
119
|
const isPrincipalIdeal: <T>(ring: ChalkboardStructure<T>, ideal: ChalkboardSet<T>) => boolean;
|
|
118
120
|
const isRing: <T>(ring: ChalkboardStructure<T>) => boolean;
|
|
119
121
|
const isSubfield: <T>(field: ChalkboardStructure<T>, subset: ChalkboardSet<T>) => boolean;
|
|
120
122
|
const isSubgroup: <T>(group: ChalkboardStructure<T>, subset: ChalkboardSet<T>) => boolean;
|
|
123
|
+
const isSubmonoid: <T>(monoid: ChalkboardStructure<T>, subset: ChalkboardSet<T>) => boolean;
|
|
121
124
|
const isSubring: <T>(ring: ChalkboardStructure<T>, subset: ChalkboardSet<T>) => boolean;
|
|
122
125
|
const isSubset: <T>(set: ChalkboardSet<T>, superset: ChalkboardSet<T>) => boolean;
|
|
123
126
|
const isSuperset: <T>(set: ChalkboardSet<T>, subset: ChalkboardSet<T>) => boolean;
|
|
@@ -125,6 +128,7 @@ declare namespace Chalkboard {
|
|
|
125
128
|
const kernel: <T, U>(morph: ChalkboardMorphism<T, U>, subset?: ChalkboardSet<T>) => ChalkboardSet<T>;
|
|
126
129
|
const Lagrange: <T>(group: ChalkboardStructure<T>, subgroup: ChalkboardSet<T>) => boolean;
|
|
127
130
|
const M: (rows: number, cols?: number) => ChalkboardSet<ChalkboardMatrix>;
|
|
131
|
+
const monoid: <T>(set: ChalkboardSet<T>, operation: (a: T, b: T) => T, identity?: T) => ChalkboardStructure<T>;
|
|
128
132
|
const N: () => ChalkboardSet<number>;
|
|
129
133
|
const order: <T>(group: ChalkboardStructure<T>, element: T) => number;
|
|
130
134
|
const P: () => ChalkboardSet<number>;
|
|
@@ -145,11 +149,41 @@ declare namespace Chalkboard {
|
|
|
145
149
|
const toObject: (struc: ChalkboardSet<number> | ChalkboardStructure<number>) => object;
|
|
146
150
|
const toString: (struc: ChalkboardSet<number> | ChalkboardStructure<number>) => string;
|
|
147
151
|
const toTensor: (struc: ChalkboardSet<number> | ChalkboardStructure<number>, ...size: number[]) => ChalkboardTensor;
|
|
152
|
+
const toTypedArray: (struc: ChalkboardSet<number> | ChalkboardStructure<number>, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
148
153
|
const toVector: (struc: ChalkboardSet<number> | ChalkboardStructure<number>, dimension: 2 | 3 | 4, index?: number) => ChalkboardVector;
|
|
149
154
|
const union: <T>(set1: ChalkboardSet<T>, set2: ChalkboardSet<T>) => ChalkboardSet<T>;
|
|
150
155
|
const Z: (n?: number) => ChalkboardSet<number>;
|
|
151
156
|
}
|
|
152
157
|
}
|
|
158
|
+
declare namespace Chalkboard {
|
|
159
|
+
namespace bool {
|
|
160
|
+
const AND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
161
|
+
const BICOND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
162
|
+
const COND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
163
|
+
const CONV: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
164
|
+
const isEqual: (expr1: string, expr2: string) => boolean | 0 | 1;
|
|
165
|
+
const Karnaugh: (input: string, variables: string[]) => (boolean | 0 | 1)[][];
|
|
166
|
+
const mapping: (inputs: (boolean | 0 | 1)[][], outputs: (boolean | 0 | 1)[][]) => ((...args: (boolean | 0 | 1)[]) => (boolean | 0 | 1)[]);
|
|
167
|
+
const minimize: (input: string, variables: string[]) => string;
|
|
168
|
+
const modeConfig: (config: "boolean" | "binary") => void;
|
|
169
|
+
const NAND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
170
|
+
const NBICOND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
171
|
+
const NCOND: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
172
|
+
const NCONV: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
173
|
+
const NOR: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
174
|
+
const NOT: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
175
|
+
const OR: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
176
|
+
const parse: (input: string, values?: Record<string, boolean | 0 | 1>, returnAST?: boolean) => string | boolean | 0 | 1 | {
|
|
177
|
+
type: string;
|
|
178
|
+
[key: string]: any;
|
|
179
|
+
};
|
|
180
|
+
const primeImplicants: (input: string, variables: string[]) => string[];
|
|
181
|
+
const toCNF: (input: string) => string;
|
|
182
|
+
const toDNF: (input: string) => string;
|
|
183
|
+
const truthTable: (...operations: ((p: boolean | 0 | 1, q: boolean | 0 | 1) => boolean | 0 | 1)[]) => (boolean | 0 | 1)[][];
|
|
184
|
+
const XOR: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
153
187
|
declare namespace Chalkboard {
|
|
154
188
|
namespace calc {
|
|
155
189
|
const autocorrelation: (func: ChalkboardFunction, val: number) => number;
|
|
@@ -225,9 +259,9 @@ declare namespace Chalkboard {
|
|
|
225
259
|
const toArray: (comp: ChalkboardComplex) => [number, number];
|
|
226
260
|
const toMatrix: (comp: ChalkboardComplex) => ChalkboardMatrix;
|
|
227
261
|
const toString: (comp: ChalkboardComplex) => string;
|
|
262
|
+
const toTypedArray: (comp: ChalkboardComplex, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
228
263
|
const toVector: (comp: ChalkboardComplex) => ChalkboardVector;
|
|
229
264
|
const val: (func: ChalkboardFunction, comp: ChalkboardComplex) => ChalkboardComplex;
|
|
230
|
-
const zero: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
231
265
|
}
|
|
232
266
|
}
|
|
233
267
|
declare namespace Chalkboard {
|
|
@@ -332,7 +366,7 @@ declare namespace Chalkboard {
|
|
|
332
366
|
Q: ChalkboardMatrix;
|
|
333
367
|
R: ChalkboardMatrix;
|
|
334
368
|
};
|
|
335
|
-
const random: (
|
|
369
|
+
const random: (rows: number, cols?: number, inf?: number, sup?: number) => ChalkboardMatrix;
|
|
336
370
|
const rank: (matr: ChalkboardMatrix) => number;
|
|
337
371
|
const reciprocate: (matr: ChalkboardMatrix) => ChalkboardMatrix;
|
|
338
372
|
const resize: (matr: ChalkboardMatrix, rows: number, cols?: number) => ChalkboardMatrix;
|
|
@@ -350,6 +384,7 @@ declare namespace Chalkboard {
|
|
|
350
384
|
const toSet: (matr: ChalkboardMatrix) => ChalkboardSet<number>;
|
|
351
385
|
const toString: (matr: ChalkboardMatrix) => string;
|
|
352
386
|
const toTensor: (matr: ChalkboardMatrix, ...size: number[]) => ChalkboardTensor;
|
|
387
|
+
const toTypedArray: (matr: ChalkboardMatrix, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
353
388
|
const toVector: (matr: ChalkboardMatrix, dimension: 2 | 3 | 4, index?: number, axis?: 0 | 1) => ChalkboardVector;
|
|
354
389
|
const trace: (matr: ChalkboardMatrix) => number;
|
|
355
390
|
const transpose: (matr: ChalkboardMatrix) => ChalkboardMatrix;
|
|
@@ -357,7 +392,7 @@ declare namespace Chalkboard {
|
|
|
357
392
|
const upperBinomial: (size: number) => ChalkboardMatrix;
|
|
358
393
|
const upperShift: (size: number) => ChalkboardMatrix;
|
|
359
394
|
const upperTriangular: (size: number, ...elements: number[]) => ChalkboardMatrix;
|
|
360
|
-
const zero: (
|
|
395
|
+
const zero: (rows: number, cols?: number) => ChalkboardMatrix;
|
|
361
396
|
}
|
|
362
397
|
}
|
|
363
398
|
declare namespace Chalkboard {
|
|
@@ -397,34 +432,11 @@ declare namespace Chalkboard {
|
|
|
397
432
|
const roundTo: (num: number, positionalIndex: number) => number;
|
|
398
433
|
const sgn: (num: number) => -1 | 0 | 1;
|
|
399
434
|
const sum: (formula: string, inf: number, sup: number) => number;
|
|
435
|
+
const toBinary: (num: number, prefix?: boolean) => string;
|
|
436
|
+
const toDecimal: (num: string, base: number) => number;
|
|
400
437
|
const toFraction: (num: number, tolerance?: number) => [number, number];
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
declare namespace Chalkboard {
|
|
404
|
-
namespace real {
|
|
405
|
-
const define: (definition: string | string[], type?: "expl" | "inve" | "pola" | "curv" | "surf" | "mult") => ChalkboardFunction;
|
|
406
|
-
const Dirac: (num: number, edge?: number, scl?: number) => number;
|
|
407
|
-
const discriminant: (a: number, b: number, c: number, form?: "stan" | "vert") => number;
|
|
408
|
-
const Heaviside: (num: number, edge?: number, scl?: number) => number;
|
|
409
|
-
const lerp: (p: [number, number], t: number) => number;
|
|
410
|
-
const linear: (x1: number, y1: number, x2: number, y2: number) => ChalkboardFunction;
|
|
411
|
-
const linearFormula: (a: number, b: number, c?: number, d?: number) => number;
|
|
412
|
-
const ln: (num: number) => number;
|
|
413
|
-
const log: (base: number, num: number) => number;
|
|
414
|
-
const log10: (num: number) => number;
|
|
415
|
-
const parse: (str: string) => Function;
|
|
416
|
-
const pingpong: (num: number, edge?: number, scl?: number) => number;
|
|
417
|
-
const pow: (base: number, num: number) => number;
|
|
418
|
-
const qerp: (p1: [number, number], p2: [number, number], p3: [number, number], t: number) => number;
|
|
419
|
-
const quadratic: (a: number, b: number, c: number, form?: "stan" | "vert") => ChalkboardFunction;
|
|
420
|
-
const quadraticFormula: (a: number, b: number, c: number, form?: "stan" | "vert") => [number, number];
|
|
421
|
-
const ramp: (num: number, edge?: number, scl?: number) => number;
|
|
422
|
-
const rect: (num: number, center?: number, width?: number, scl?: number) => number;
|
|
423
|
-
const root: (num: number, index?: number) => number;
|
|
424
|
-
const slope: (x1: number, y1: number, x2: number, y2: number) => number;
|
|
425
|
-
const sqrt: (num: number) => number;
|
|
426
|
-
const tetration: (base: number, num: number) => number | undefined;
|
|
427
|
-
const val: (func: ChalkboardFunction, val: number | ChalkboardVector) => number | ChalkboardVector;
|
|
438
|
+
const toHexadecimal: (num: number, prefix?: boolean, uppercase?: boolean) => string;
|
|
439
|
+
const toOctal: (num: number, prefix?: boolean) => string;
|
|
428
440
|
}
|
|
429
441
|
}
|
|
430
442
|
declare namespace Chalkboard {
|
|
@@ -635,8 +647,48 @@ declare namespace Chalkboard {
|
|
|
635
647
|
const toMatrix: (quat: ChalkboardQuaternion) => ChalkboardMatrix;
|
|
636
648
|
const toRotation: (quat: ChalkboardQuaternion, vect: ChalkboardVector) => ChalkboardVector;
|
|
637
649
|
const toString: (quat: ChalkboardQuaternion) => string;
|
|
650
|
+
const toTypedArray: (quat: ChalkboardQuaternion, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
638
651
|
const toVector: (quat: ChalkboardQuaternion) => ChalkboardVector;
|
|
639
|
-
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
declare namespace Chalkboard {
|
|
655
|
+
namespace real {
|
|
656
|
+
const absolute: (func: ChalkboardFunction) => ChalkboardFunction;
|
|
657
|
+
const add: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
658
|
+
const compose: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
659
|
+
const define: (definition: string | string[], type?: "expl" | "inve" | "pola" | "curv" | "surf" | "mult") => ChalkboardFunction;
|
|
660
|
+
const Dirac: (num: number, edge?: number, scl?: number) => number;
|
|
661
|
+
const discriminant: (a: number, b: number, c: number, form?: "stan" | "vert") => number;
|
|
662
|
+
const div: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
663
|
+
const Heaviside: (num: number, edge?: number, scl?: number) => number;
|
|
664
|
+
const lerp: (p: [number, number], t: number) => number;
|
|
665
|
+
const linear: (x1: number, y1: number, x2: number, y2: number) => ChalkboardFunction;
|
|
666
|
+
const linearFormula: (a: number, b: number, c?: number, d?: number) => number;
|
|
667
|
+
const ln: (num: number) => number;
|
|
668
|
+
const log: (base: number, num: number) => number;
|
|
669
|
+
const log10: (num: number) => number;
|
|
670
|
+
const mul: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
671
|
+
const negate: (func: ChalkboardFunction) => ChalkboardFunction;
|
|
672
|
+
const parse: (str: string) => Function;
|
|
673
|
+
const pingpong: (num: number, edge?: number, scl?: number) => number;
|
|
674
|
+
const polynomial: (...coeffs: number[]) => ChalkboardFunction;
|
|
675
|
+
const pow: (base: number | ChalkboardFunction, num: number) => number | ChalkboardFunction;
|
|
676
|
+
const qerp: (p1: [number, number], p2: [number, number], p3: [number, number], t: number) => number;
|
|
677
|
+
const quadratic: (a: number, b: number, c: number, form?: "stan" | "vert") => ChalkboardFunction;
|
|
678
|
+
const quadraticFormula: (a: number, b: number, c: number, form?: "stan" | "vert") => [number, number];
|
|
679
|
+
const ramp: (num: number, edge?: number, scl?: number) => number;
|
|
680
|
+
const randomPolynomial: (degree: number, inf?: number, sup?: number) => ChalkboardFunction;
|
|
681
|
+
const reciprocate: (func: ChalkboardFunction) => ChalkboardFunction;
|
|
682
|
+
const rect: (num: number, center?: number, width?: number, scl?: number) => number;
|
|
683
|
+
const root: (num: number, index?: number) => number;
|
|
684
|
+
const scl: (func: ChalkboardFunction, num: number) => ChalkboardFunction;
|
|
685
|
+
const slope: (x1: number, y1: number, x2: number, y2: number) => number;
|
|
686
|
+
const sqrt: (num: number) => number;
|
|
687
|
+
const sub: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
688
|
+
const tetration: (base: number, num: number) => number | undefined;
|
|
689
|
+
const translate: (func: ChalkboardFunction, h?: number, v?: number) => ChalkboardFunction;
|
|
690
|
+
const val: (func: ChalkboardFunction, val: number | ChalkboardVector) => number | ChalkboardVector;
|
|
691
|
+
const zero: (type?: "expl" | "inve" | "pola" | "curv" | "surf" | "mult") => ChalkboardFunction;
|
|
640
692
|
}
|
|
641
693
|
}
|
|
642
694
|
declare namespace Chalkboard {
|
|
@@ -689,7 +741,7 @@ declare namespace Chalkboard {
|
|
|
689
741
|
const percentile: (arr: number[], num: number) => number;
|
|
690
742
|
const print: (arr: number[]) => void;
|
|
691
743
|
const quartile: (arr: number[], type: "Q1" | "Q2" | "Q3") => number;
|
|
692
|
-
const random: (
|
|
744
|
+
const random: (length: number, inf?: number, sup?: number) => number[];
|
|
693
745
|
const range: (arr: number[]) => number;
|
|
694
746
|
const regression: (data: number[][], type?: "linear" | "polynomial" | "power" | "exponential" | "logarithmic", degree?: number) => ChalkboardFunction;
|
|
695
747
|
const resampling: (arr: number[], samples?: number, type?: "bootstrap" | "jackknife") => number[][];
|
|
@@ -746,9 +798,10 @@ declare namespace Chalkboard {
|
|
|
746
798
|
const toObject: (tens: ChalkboardTensor) => object | number;
|
|
747
799
|
const toSet: (tens: ChalkboardTensor) => ChalkboardSet<number>;
|
|
748
800
|
const toString: (tens: ChalkboardTensor, indentation?: number) => string;
|
|
801
|
+
const toTypedArray: (tens: ChalkboardTensor, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
749
802
|
const toVector: (tens: ChalkboardTensor, dimension: number, index?: number) => ChalkboardVector;
|
|
750
803
|
const transpose: (tens: ChalkboardTensor) => ChalkboardTensor;
|
|
751
|
-
const zero: (
|
|
804
|
+
const zero: (...size: number[]) => ChalkboardTensor;
|
|
752
805
|
}
|
|
753
806
|
}
|
|
754
807
|
declare namespace Chalkboard {
|
|
@@ -805,7 +858,7 @@ declare namespace Chalkboard {
|
|
|
805
858
|
const fromField: (vectfield: ChalkboardVectorField, vect: ChalkboardVector) => ChalkboardVector;
|
|
806
859
|
const fromVector: (vect: ChalkboardVector) => ChalkboardVector;
|
|
807
860
|
const init: (x: number, y: number, z?: number, w?: number) => ChalkboardVector;
|
|
808
|
-
const
|
|
861
|
+
const interpolate: (vect: ChalkboardVector, a: number, b: number, c?: number, d?: number) => ChalkboardVector;
|
|
809
862
|
const isDimensionEqual: (vect1: ChalkboardVector, vect2: ChalkboardVector) => boolean;
|
|
810
863
|
const isDimensionOf: (vectORvectfield: ChalkboardVector | ChalkboardVectorField, dimension: 2 | 3 | 4) => boolean;
|
|
811
864
|
const isEqual: (vect1: ChalkboardVector, vect2: ChalkboardVector) => boolean;
|
|
@@ -816,12 +869,13 @@ declare namespace Chalkboard {
|
|
|
816
869
|
const mag: (vect: ChalkboardVector) => number;
|
|
817
870
|
const magset: (vect: ChalkboardVector, num: number) => ChalkboardVector;
|
|
818
871
|
const magsq: (vect: ChalkboardVector) => number;
|
|
872
|
+
const modeConfig: (config: "vector" | "array" | "float32array" | "float64array" | "matrix" | "string" | "json") => void;
|
|
819
873
|
const negate: (vect: ChalkboardVector) => ChalkboardVector;
|
|
820
874
|
const normalize: (vect: ChalkboardVector) => ChalkboardVector;
|
|
821
875
|
const oproj: (vect1: ChalkboardVector, vect2: ChalkboardVector) => ChalkboardVector;
|
|
822
876
|
const print: (vect: ChalkboardVector) => void;
|
|
823
877
|
const proj: (vect1: ChalkboardVector, vect2: ChalkboardVector) => ChalkboardVector;
|
|
824
|
-
const random: (
|
|
878
|
+
const random: (dimension: 2 | 3 | 4, inf?: number, sup?: number) => ChalkboardVector;
|
|
825
879
|
const reciprocate: (vect: ChalkboardVector) => ChalkboardVector;
|
|
826
880
|
const reflect: (vect1: ChalkboardVector, vect2: ChalkboardVector) => ChalkboardVector;
|
|
827
881
|
const refract: (vect1: ChalkboardVector, vect2: ChalkboardVector, refractiveIndex: number) => ChalkboardVector;
|
|
@@ -837,9 +891,10 @@ declare namespace Chalkboard {
|
|
|
837
891
|
const toQuaternion: (vect: ChalkboardVector) => ChalkboardQuaternion;
|
|
838
892
|
const toString: (vect: ChalkboardVector) => string;
|
|
839
893
|
const toTensor: (vect: ChalkboardVector, ...size: number[]) => ChalkboardTensor;
|
|
894
|
+
const toTypedArray: (vect: ChalkboardVector, type?: "int8" | "int16" | "int32" | "float32" | "float64" | "bigint64") => Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
|
|
840
895
|
const vectorQuadruple: (vect1: ChalkboardVector, vect2: ChalkboardVector, vect3: ChalkboardVector, vect4: ChalkboardVector) => ChalkboardVector;
|
|
841
896
|
const vectorTriple: (vect1: ChalkboardVector, vect2: ChalkboardVector, vect3: ChalkboardVector) => ChalkboardVector;
|
|
842
|
-
const zero: (
|
|
897
|
+
const zero: (dimension: 2 | 3 | 4) => ChalkboardVector;
|
|
843
898
|
}
|
|
844
899
|
}
|
|
845
900
|
//# sourceMappingURL=Chalkboard.d.ts.map
|