@zushah/chalkboard 2.4.0 → 3.0.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 +289 -248
- package/LICENSE.md +328 -21
- package/README.md +115 -98
- package/dist/Chalkboard.d.ts +236 -50
- package/dist/Chalkboard.d.ts.map +1 -1
- package/dist/Chalkboard.js +7085 -4148
- package/dist/Chalkboard.js.map +1 -1
- package/dist/Chalkboard.min.js +1 -0
- package/package.json +22 -27
package/dist/Chalkboard.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ type ChalkboardComplex = {
|
|
|
3
3
|
b: number;
|
|
4
4
|
};
|
|
5
5
|
type ChalkboardFunction = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
rule: ((...x: number[]) => number) | (((...x: number[]) => number)[]);
|
|
7
|
+
field: "real" | "comp";
|
|
8
|
+
type: "scalar2d" | "scalar3d" | "scalar4d" | "vector2d" | "vector3d" | "vector4d" | "curve2d" | "curve3d" | "curve4d" | "surface3d";
|
|
8
9
|
};
|
|
9
10
|
type ChalkboardMatrix = number[][];
|
|
10
11
|
type ChalkboardMorphism<T, U> = {
|
|
@@ -12,6 +13,12 @@ type ChalkboardMorphism<T, U> = {
|
|
|
12
13
|
struc2: ChalkboardStructure<U>;
|
|
13
14
|
mapping: (a: T) => U;
|
|
14
15
|
};
|
|
16
|
+
type ChalkboardODE = {
|
|
17
|
+
rule: (t: number, y: number[]) => number[];
|
|
18
|
+
order: number;
|
|
19
|
+
dimension: number;
|
|
20
|
+
type: "single" | "system";
|
|
21
|
+
};
|
|
15
22
|
type ChalkboardQuaternion = {
|
|
16
23
|
a: number;
|
|
17
24
|
b: number;
|
|
@@ -51,23 +58,16 @@ type ChalkboardVector = {
|
|
|
51
58
|
z?: number;
|
|
52
59
|
w?: number;
|
|
53
60
|
} | number[] | Float32Array | Float64Array | ChalkboardMatrix | string;
|
|
54
|
-
type ChalkboardVectorField = {
|
|
55
|
-
p: string;
|
|
56
|
-
q: string;
|
|
57
|
-
r?: string;
|
|
58
|
-
s?: string;
|
|
59
|
-
};
|
|
60
61
|
declare namespace Chalkboard {
|
|
61
62
|
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
63
|
let CONTEXT: string;
|
|
63
64
|
const E: (exponent?: number) => number;
|
|
64
65
|
const I: (exponent?: number) => ChalkboardComplex;
|
|
65
|
-
const LOGO: (x?: number, y?: number, size?: number, context?: CanvasRenderingContext2D) => void;
|
|
66
|
-
let PARSEPREFIX: string;
|
|
67
66
|
const PI: (coefficient?: number) => number;
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
67
|
+
const REGISTER: (name: string, func: (...x: number[]) => number) => void;
|
|
68
|
+
const REGISTRY: Record<string, (...x: number[]) => number>;
|
|
69
|
+
const VERSION: "3.0.0";
|
|
70
|
+
const VERSIONALIAS: "Euler";
|
|
71
71
|
}
|
|
72
72
|
declare namespace Chalkboard {
|
|
73
73
|
namespace abal {
|
|
@@ -173,7 +173,12 @@ declare namespace Chalkboard {
|
|
|
173
173
|
const NOR: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
174
174
|
const NOT: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
175
175
|
const OR: (...vals: (boolean | 0 | 1)[]) => boolean | 0 | 1;
|
|
176
|
-
const parse: (
|
|
176
|
+
const parse: (expr: string, config?: {
|
|
177
|
+
values?: Record<string, boolean | 0 | 1>;
|
|
178
|
+
returnAST?: boolean;
|
|
179
|
+
returnJSON?: boolean;
|
|
180
|
+
returnLaTeX?: boolean;
|
|
181
|
+
}) => string | boolean | 0 | 1 | {
|
|
177
182
|
type: string;
|
|
178
183
|
[key: string]: any;
|
|
179
184
|
};
|
|
@@ -190,7 +195,7 @@ declare namespace Chalkboard {
|
|
|
190
195
|
const binormal: (func: ChalkboardFunction, val: number) => ChalkboardVector;
|
|
191
196
|
const convolution: (func1: ChalkboardFunction, func2: ChalkboardFunction, val: number) => number;
|
|
192
197
|
const correlation: (func1: ChalkboardFunction, func2: ChalkboardFunction, val: number) => number;
|
|
193
|
-
const curl: (vectfield:
|
|
198
|
+
const curl: (vectfield: ChalkboardFunction, vect: ChalkboardVector) => ChalkboardVector;
|
|
194
199
|
const curvature: (func: ChalkboardFunction, val: number) => number;
|
|
195
200
|
const dfdv: (func: ChalkboardFunction, vectpos: ChalkboardVector, vectdir: ChalkboardVector) => number;
|
|
196
201
|
const dfdx: (func: ChalkboardFunction, val: number) => number | ChalkboardVector;
|
|
@@ -198,64 +203,92 @@ declare namespace Chalkboard {
|
|
|
198
203
|
const dfdz: (func: ChalkboardFunction, comp: ChalkboardComplex) => [ChalkboardComplex, ChalkboardComplex];
|
|
199
204
|
const d2fdz2: (func: ChalkboardFunction, comp: ChalkboardComplex) => [ChalkboardComplex, ChalkboardComplex];
|
|
200
205
|
const dfrdt: (func1: ChalkboardFunction, func2: ChalkboardFunction, val: number) => number;
|
|
201
|
-
const
|
|
206
|
+
const dft: (arr: (number | ChalkboardComplex)[]) => ChalkboardComplex[];
|
|
207
|
+
const div: (vectfield: ChalkboardFunction, vect: ChalkboardVector) => number;
|
|
202
208
|
const extrema: (func: ChalkboardFunction, domain: [number, number]) => number[];
|
|
203
209
|
const fds: (func: ChalkboardFunction, tinf: number, tsup: number, sinf?: number, ssup?: number) => number;
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
210
|
+
const fft: (arr: (number | ChalkboardComplex)[]) => ChalkboardComplex[];
|
|
211
|
+
const fftfreq: (n: number, d?: number) => number[];
|
|
212
|
+
const fftshift: (arr: ChalkboardComplex[]) => ChalkboardComplex[];
|
|
213
|
+
const fnds: (vectfield: ChalkboardFunction, func: ChalkboardFunction, tinf: number, tsup: number, sinf?: number, ssup?: number) => number;
|
|
214
|
+
const Fourier: (func: ChalkboardFunction, val: number, inf?: number, sup?: number, steps?: number) => number;
|
|
215
|
+
const frds: (funcORvectfield: ChalkboardFunction, func: ChalkboardFunction, inf: number, sup: number) => number;
|
|
207
216
|
const fxdx: (func: ChalkboardFunction, inf: number, sup: number) => number | ChalkboardVector;
|
|
208
217
|
const fxydxdy: (func: ChalkboardFunction, xinf: number, xsup: number, yinf: number, ysup: number) => number;
|
|
209
218
|
const fzdz: (func1: ChalkboardFunction, func2: ChalkboardFunction, inf: number, sup: number) => ChalkboardComplex;
|
|
210
|
-
const grad: (funcORvectfield: ChalkboardFunction
|
|
211
|
-
const grad2: (funcORvectfield: ChalkboardFunction
|
|
219
|
+
const grad: (funcORvectfield: ChalkboardFunction, vect: ChalkboardVector) => ChalkboardVector | ChalkboardMatrix;
|
|
220
|
+
const grad2: (funcORvectfield: ChalkboardFunction, vect: ChalkboardVector) => ChalkboardMatrix;
|
|
221
|
+
const idft: (arr: (number | ChalkboardComplex)[]) => ChalkboardComplex[];
|
|
222
|
+
const ifft: (arr: (number | ChalkboardComplex)[]) => ChalkboardComplex[];
|
|
223
|
+
const ifftshift: (arr: ChalkboardComplex[]) => ChalkboardComplex[];
|
|
224
|
+
const iFourier: (func: ChalkboardFunction, val: number, inf?: number, sup?: number, steps?: number) => number;
|
|
225
|
+
const irfft: (arr: (number | ChalkboardComplex)[], n?: number) => number[];
|
|
212
226
|
const Laplace: (func: ChalkboardFunction, val: number) => number;
|
|
213
227
|
const lim: (func: ChalkboardFunction, val: number) => number | undefined;
|
|
214
228
|
const mean: (func: ChalkboardFunction, inf: number, sup: number) => number;
|
|
215
229
|
const Newton: (func: ChalkboardFunction, domain?: [number, number]) => number;
|
|
216
230
|
const normal: (func: ChalkboardFunction, val: number) => ChalkboardVector;
|
|
231
|
+
const rfft: (arr: number[]) => ChalkboardComplex[];
|
|
217
232
|
const tangent: (func: ChalkboardFunction, val: number) => ChalkboardVector;
|
|
218
233
|
const Taylor: (func: ChalkboardFunction, val: number, n: 0 | 1 | 2, a: number) => number;
|
|
219
234
|
}
|
|
220
235
|
}
|
|
221
236
|
declare namespace Chalkboard {
|
|
222
237
|
namespace comp {
|
|
223
|
-
const absolute: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
224
|
-
const add: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => ChalkboardComplex;
|
|
238
|
+
const absolute: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
239
|
+
const add: (comp1: ChalkboardComplex | number | ChalkboardFunction, comp2: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
225
240
|
const arg: (comp: ChalkboardComplex) => number;
|
|
226
241
|
const argBetween: (comp1: ChalkboardComplex, comp2: ChalkboardComplex) => number;
|
|
227
|
-
const conjugate: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
242
|
+
const conjugate: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
228
243
|
const constrain: (comp: ChalkboardComplex, range?: [number, number]) => ChalkboardComplex;
|
|
229
244
|
const copy: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
230
|
-
const
|
|
245
|
+
const cos: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
246
|
+
const define: (...rule: (((z: ChalkboardComplex) => ChalkboardComplex) | ((a: number, b: number) => number))[]) => ChalkboardFunction;
|
|
231
247
|
const dist: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => number;
|
|
232
248
|
const distsq: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => number;
|
|
233
|
-
const div: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => ChalkboardComplex;
|
|
249
|
+
const div: (comp1: ChalkboardComplex | number | ChalkboardFunction, comp2: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
234
250
|
const Euler: (rad: number) => ChalkboardComplex;
|
|
235
|
-
const
|
|
251
|
+
const exp: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
252
|
+
const Im: (funcORcomp: ChalkboardFunction | ChalkboardComplex) => Function | number;
|
|
236
253
|
const init: (a: number, b?: number) => ChalkboardComplex;
|
|
237
254
|
const invert: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
255
|
+
const isApproxEqual: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number, precision?: number) => boolean;
|
|
256
|
+
const isEqual: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => boolean;
|
|
257
|
+
const isInverse: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number, precision?: number) => boolean;
|
|
258
|
+
const isNormalized: (comp: ChalkboardComplex) => boolean;
|
|
259
|
+
const isZero: (comp: ChalkboardComplex | number) => boolean;
|
|
238
260
|
const ln: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
239
261
|
const mag: (comp: ChalkboardComplex) => number;
|
|
240
262
|
const magset: (comp: ChalkboardComplex, num: number) => ChalkboardComplex;
|
|
241
263
|
const magsq: (comp: ChalkboardComplex) => number;
|
|
242
|
-
const mul: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => ChalkboardComplex;
|
|
243
|
-
const negate: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
264
|
+
const mul: (comp1: ChalkboardComplex | number | ChalkboardFunction, comp2: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
265
|
+
const negate: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
244
266
|
const normalize: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
245
|
-
const parse: (
|
|
246
|
-
|
|
267
|
+
const parse: (expr: string, config?: {
|
|
268
|
+
values?: Record<string, ChalkboardComplex>;
|
|
269
|
+
roundTo?: number;
|
|
270
|
+
returnAST?: boolean;
|
|
271
|
+
returnJSON?: boolean;
|
|
272
|
+
returnLaTeX?: boolean;
|
|
273
|
+
}) => string | ChalkboardComplex | {
|
|
274
|
+
type: string;
|
|
275
|
+
[key: string]: any;
|
|
276
|
+
};
|
|
277
|
+
const pow: (comp: ChalkboardComplex | number | ChalkboardFunction, num: number) => ChalkboardComplex | ChalkboardFunction;
|
|
247
278
|
const print: (comp: ChalkboardComplex) => void;
|
|
248
279
|
const random: (inf?: number, sup?: number) => ChalkboardComplex;
|
|
249
|
-
const Re: (funcORcomp: ChalkboardFunction | ChalkboardComplex) =>
|
|
250
|
-
const reciprocate: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
280
|
+
const Re: (funcORcomp: ChalkboardFunction | ChalkboardComplex) => Function | number;
|
|
281
|
+
const reciprocate: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
251
282
|
const root: (comp: ChalkboardComplex, index?: number) => ChalkboardComplex[];
|
|
252
283
|
const rotate: (comp: ChalkboardComplex, rad: number) => ChalkboardComplex;
|
|
253
284
|
const round: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
254
|
-
const scl: (comp: ChalkboardComplex, num: number) => ChalkboardComplex;
|
|
285
|
+
const scl: (comp: ChalkboardComplex | number | ChalkboardFunction, num: number) => ChalkboardComplex | ChalkboardFunction;
|
|
286
|
+
const sin: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
255
287
|
const slope: (comp: ChalkboardComplex) => number;
|
|
256
|
-
const sq: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
257
|
-
const sqrt: (comp: ChalkboardComplex) => ChalkboardComplex;
|
|
258
|
-
const sub: (comp1: ChalkboardComplex | number, comp2: ChalkboardComplex | number) => ChalkboardComplex;
|
|
288
|
+
const sq: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
289
|
+
const sqrt: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
290
|
+
const sub: (comp1: ChalkboardComplex | number | ChalkboardFunction, comp2: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
291
|
+
const tan: (comp: ChalkboardComplex | number | ChalkboardFunction) => ChalkboardComplex | ChalkboardFunction;
|
|
259
292
|
const toArray: (comp: ChalkboardComplex) => [number, number];
|
|
260
293
|
const toMatrix: (comp: ChalkboardComplex) => ChalkboardMatrix;
|
|
261
294
|
const toString: (comp: ChalkboardComplex) => string;
|
|
@@ -264,6 +297,114 @@ declare namespace Chalkboard {
|
|
|
264
297
|
const val: (func: ChalkboardFunction, comp: ChalkboardComplex) => ChalkboardComplex;
|
|
265
298
|
}
|
|
266
299
|
}
|
|
300
|
+
declare namespace Chalkboard {
|
|
301
|
+
namespace diff {
|
|
302
|
+
const at: (sol: {
|
|
303
|
+
t: number[];
|
|
304
|
+
y: number[][];
|
|
305
|
+
}, time: number) => number[];
|
|
306
|
+
const Bernoulli: (p: number | ((t: number) => number), q: number | ((t: number) => number), n: number) => ChalkboardODE;
|
|
307
|
+
const BesselI: (nu?: number) => ChalkboardODE;
|
|
308
|
+
const BesselJ: (nu?: number) => ChalkboardODE;
|
|
309
|
+
const closestIndex: (t: number[], target: number) => number;
|
|
310
|
+
const component: (sol: {
|
|
311
|
+
t: number[];
|
|
312
|
+
y: number[][];
|
|
313
|
+
}, index: number) => number[];
|
|
314
|
+
const derivative: (sol: {
|
|
315
|
+
t: number[];
|
|
316
|
+
y: number[][];
|
|
317
|
+
}) => number[][];
|
|
318
|
+
const Duffing: (delta: number, alpha: number, beta: number, gamma: number, omega: number) => ChalkboardODE;
|
|
319
|
+
const error: (sol: {
|
|
320
|
+
t: number[];
|
|
321
|
+
y: number[][];
|
|
322
|
+
}, ode: ChalkboardODE, norm?: "L1" | "L2" | "LInfinity") => {
|
|
323
|
+
t: number[];
|
|
324
|
+
e: number[];
|
|
325
|
+
max: number;
|
|
326
|
+
mean: number;
|
|
327
|
+
rmse: number;
|
|
328
|
+
};
|
|
329
|
+
const exponential: (k?: number) => ChalkboardODE;
|
|
330
|
+
const Gompertz: (a?: number, K?: number) => ChalkboardODE;
|
|
331
|
+
const harmonic: (w?: number) => ChalkboardODE;
|
|
332
|
+
const harmonicDamped: (w?: number, zeta?: number) => ChalkboardODE;
|
|
333
|
+
const harmonicForced: (w: number, zeta: number, F: (t: number) => number) => ChalkboardODE;
|
|
334
|
+
const init: (rule: ((t: number, y: number) => number) | ((t: number, y: number, dy: number) => number) | ((t: number, y: number[]) => number[]), dimension?: number) => ChalkboardODE;
|
|
335
|
+
const Kepler2D: (mu?: number) => ChalkboardODE;
|
|
336
|
+
const Kepler3D: (mu?: number) => ChalkboardODE;
|
|
337
|
+
const linear1: (a: ((t: number) => number) | number, b: ((t: number) => number) | number) => ChalkboardODE;
|
|
338
|
+
const linear2: (a: ((t: number) => number) | number, b: ((t: number) => number) | number, c: ((t: number) => number) | number) => ChalkboardODE;
|
|
339
|
+
const logistic: (r?: number, K?: number) => ChalkboardODE;
|
|
340
|
+
const Lorenz: (sigma?: number, rho?: number, beta?: number) => ChalkboardODE;
|
|
341
|
+
const LotkaVolterra: (alpha?: number, beta?: number, gamma?: number, delta?: number) => ChalkboardODE;
|
|
342
|
+
const massSpringDamper: (m: number, c: number, k: number) => ChalkboardODE;
|
|
343
|
+
const pendulum: (params?: {
|
|
344
|
+
g?: number;
|
|
345
|
+
L?: number;
|
|
346
|
+
b?: number;
|
|
347
|
+
tau?: (t: number) => number;
|
|
348
|
+
}) => ChalkboardODE;
|
|
349
|
+
const pendulumDrag: (params?: {
|
|
350
|
+
g?: number;
|
|
351
|
+
L?: number;
|
|
352
|
+
b?: number;
|
|
353
|
+
c?: number;
|
|
354
|
+
tau?: (t: number) => number;
|
|
355
|
+
}) => ChalkboardODE;
|
|
356
|
+
const pendulumDriven: (q?: number, A?: number, Omega?: number) => ChalkboardODE;
|
|
357
|
+
const phase: (sol: {
|
|
358
|
+
t: number[];
|
|
359
|
+
y: number[][];
|
|
360
|
+
}, i: number, j: number) => number[][];
|
|
361
|
+
const sample: (sol: {
|
|
362
|
+
t: number[];
|
|
363
|
+
y: number[][];
|
|
364
|
+
}, times: number[]) => number[][];
|
|
365
|
+
const separable: (f: (t: number) => number, g: (y: number) => number) => ChalkboardODE;
|
|
366
|
+
const SEIR: (beta?: number, sigma?: number, gamma?: number) => ChalkboardODE;
|
|
367
|
+
const SIR: (beta?: number, gamma?: number) => ChalkboardODE;
|
|
368
|
+
const SIS: (beta?: number, gamma?: number) => ChalkboardODE;
|
|
369
|
+
const solve: (ode: ChalkboardODE, config: {
|
|
370
|
+
t0?: number;
|
|
371
|
+
t1: number;
|
|
372
|
+
h?: number;
|
|
373
|
+
steps?: number;
|
|
374
|
+
y0: number | number[] | Record<string, any>;
|
|
375
|
+
method?: "euler" | "midpoint" | "heun" | "ralston" | "rk4";
|
|
376
|
+
returnObject?: boolean;
|
|
377
|
+
}) => {
|
|
378
|
+
t: number[];
|
|
379
|
+
y: number[][];
|
|
380
|
+
yObj?: {
|
|
381
|
+
[key: string]: number;
|
|
382
|
+
}[];
|
|
383
|
+
};
|
|
384
|
+
const solveAdaptive: (ode: ChalkboardODE, config: {
|
|
385
|
+
t0?: number;
|
|
386
|
+
t1: number;
|
|
387
|
+
y0: number | number[] | Record<string, any>;
|
|
388
|
+
h0?: number;
|
|
389
|
+
hMin?: number;
|
|
390
|
+
hMax?: number;
|
|
391
|
+
rtol?: number;
|
|
392
|
+
atol?: number;
|
|
393
|
+
maxSteps?: number;
|
|
394
|
+
returnObject?: boolean;
|
|
395
|
+
}) => {
|
|
396
|
+
t: number[];
|
|
397
|
+
y: number[][];
|
|
398
|
+
yObj?: {
|
|
399
|
+
[key: string]: number;
|
|
400
|
+
}[];
|
|
401
|
+
};
|
|
402
|
+
const toScalarSeries: (sol: {
|
|
403
|
+
t: number[];
|
|
404
|
+
y: number[][];
|
|
405
|
+
}) => number[];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
267
408
|
declare namespace Chalkboard {
|
|
268
409
|
namespace geom {
|
|
269
410
|
const circleA: (r: number) => number;
|
|
@@ -310,6 +451,10 @@ declare namespace Chalkboard {
|
|
|
310
451
|
const add: (matr1: ChalkboardMatrix, matr2: ChalkboardMatrix) => ChalkboardMatrix;
|
|
311
452
|
const addKronecker: (matr1: ChalkboardMatrix, matr2: ChalkboardMatrix) => ChalkboardMatrix;
|
|
312
453
|
const adjugate: (matr: ChalkboardMatrix, row: number, col: number) => ChalkboardMatrix;
|
|
454
|
+
const Cholesky: (matr: ChalkboardMatrix) => {
|
|
455
|
+
L: ChalkboardMatrix;
|
|
456
|
+
U: ChalkboardMatrix;
|
|
457
|
+
};
|
|
313
458
|
const cofactor: (matr: ChalkboardMatrix, row: number, col: number) => ChalkboardMatrix;
|
|
314
459
|
const cols: (matr: ChalkboardMatrix) => number;
|
|
315
460
|
const colspace: (matr: ChalkboardMatrix) => ChalkboardMatrix;
|
|
@@ -328,6 +473,7 @@ declare namespace Chalkboard {
|
|
|
328
473
|
const identity: (size: number) => ChalkboardMatrix;
|
|
329
474
|
const init: (...matrix: number[][] | number[][][]) => ChalkboardMatrix;
|
|
330
475
|
const invert: (matr: ChalkboardMatrix) => ChalkboardMatrix;
|
|
476
|
+
const isApproxEqual: (matr1: ChalkboardMatrix, matr2: ChalkboardMatrix, precision?: number) => boolean;
|
|
331
477
|
const isDiagonal: (matr: ChalkboardMatrix) => boolean;
|
|
332
478
|
const isEqual: (matr1: ChalkboardMatrix, matr2: ChalkboardMatrix) => boolean;
|
|
333
479
|
const isIdentity: (matr: ChalkboardMatrix) => boolean;
|
|
@@ -404,13 +550,14 @@ declare namespace Chalkboard {
|
|
|
404
550
|
const compositeArr: (inf: number, sup: number) => number[];
|
|
405
551
|
const compositeCount: (inf: number, sup: number) => number;
|
|
406
552
|
const constrain: (num: number, range?: [number, number]) => number;
|
|
553
|
+
const convert: (num: number | number[], from: string, to: string) => number | number[];
|
|
407
554
|
const divisors: (num: number) => number[];
|
|
408
|
-
const Euler: (num: number) => number
|
|
555
|
+
const Euler: (num: number) => number;
|
|
409
556
|
const exponential: (l?: number) => number;
|
|
410
557
|
const factorial: (num: number) => number;
|
|
411
558
|
const factors: (num: number) => number[];
|
|
412
559
|
const Fibonacci: (num: number) => number;
|
|
413
|
-
const Gaussian: (
|
|
560
|
+
const Gaussian: (mean: number, deviation: number) => number;
|
|
414
561
|
const gcd: (a: number, b: number) => number;
|
|
415
562
|
const Goldbach: (num: number) => [number, number] | undefined;
|
|
416
563
|
const isApproxEqual: (a: number, b: number, precision?: number) => boolean;
|
|
@@ -420,7 +567,7 @@ declare namespace Chalkboard {
|
|
|
420
567
|
const lcm: (a: number, b: number) => number;
|
|
421
568
|
const map: (num: number, range1: number[], range2: number[]) => number;
|
|
422
569
|
const mod: (a: number, b: number) => number;
|
|
423
|
-
const mul: (formula:
|
|
570
|
+
const mul: (formula: (n: number) => number, inf: number, sup: number) => number;
|
|
424
571
|
const nextPrime: (num: number) => number;
|
|
425
572
|
const permutation: (n: number, r: number) => number;
|
|
426
573
|
const Poissonian: (l?: number) => number;
|
|
@@ -430,8 +577,8 @@ declare namespace Chalkboard {
|
|
|
430
577
|
const primeGap: (inf: number, sup: number) => number;
|
|
431
578
|
const random: (inf?: number, sup?: number) => number;
|
|
432
579
|
const roundTo: (num: number, positionalIndex: number) => number;
|
|
433
|
-
const sgn: (num: number) => -1 | 0 | 1;
|
|
434
|
-
const sum: (formula:
|
|
580
|
+
const sgn: (num: number) => -1 | 0 | 1 | undefined;
|
|
581
|
+
const sum: (formula: (n: number) => number, inf: number, sup: number) => number;
|
|
435
582
|
const toBinary: (num: number, prefix?: boolean) => string;
|
|
436
583
|
const toDecimal: (num: string, base: number) => number;
|
|
437
584
|
const toFraction: (num: number, tolerance?: number) => [number, number];
|
|
@@ -495,6 +642,9 @@ declare namespace Chalkboard {
|
|
|
495
642
|
strokeStyle: string;
|
|
496
643
|
lineWidth: number;
|
|
497
644
|
domain: [number, number] | [[number, number], [number, number]];
|
|
645
|
+
res: number;
|
|
646
|
+
isInverse: boolean;
|
|
647
|
+
isPolar: boolean;
|
|
498
648
|
context: CanvasRenderingContext2D;
|
|
499
649
|
}) => number[][];
|
|
500
650
|
const dfdx: (func: ChalkboardFunction, config: {
|
|
@@ -505,6 +655,7 @@ declare namespace Chalkboard {
|
|
|
505
655
|
lineWidth: number;
|
|
506
656
|
domain: [number, number];
|
|
507
657
|
res: number;
|
|
658
|
+
isInverse: boolean;
|
|
508
659
|
context: CanvasRenderingContext2D;
|
|
509
660
|
}) => number[][];
|
|
510
661
|
const d2fdx2: (func: ChalkboardFunction, config: {
|
|
@@ -515,9 +666,10 @@ declare namespace Chalkboard {
|
|
|
515
666
|
lineWidth: number;
|
|
516
667
|
domain: [number, number];
|
|
517
668
|
res: number;
|
|
669
|
+
isInverse: boolean;
|
|
518
670
|
context: CanvasRenderingContext2D;
|
|
519
671
|
}) => number[][];
|
|
520
|
-
const field: (vectfield:
|
|
672
|
+
const field: (vectfield: ChalkboardFunction, config: {
|
|
521
673
|
x: number;
|
|
522
674
|
y: number;
|
|
523
675
|
size: number;
|
|
@@ -545,6 +697,7 @@ declare namespace Chalkboard {
|
|
|
545
697
|
lineWidth: number;
|
|
546
698
|
domain: [number, number];
|
|
547
699
|
res: number;
|
|
700
|
+
isInverse: boolean;
|
|
548
701
|
context: CanvasRenderingContext2D;
|
|
549
702
|
}) => number[][];
|
|
550
703
|
const Laplace: (func: ChalkboardFunction, config: {
|
|
@@ -574,6 +727,20 @@ declare namespace Chalkboard {
|
|
|
574
727
|
domain: [number, number];
|
|
575
728
|
context: CanvasRenderingContext2D;
|
|
576
729
|
}) => number[][];
|
|
730
|
+
const ode: (sol: {
|
|
731
|
+
t: number[];
|
|
732
|
+
y: number[][];
|
|
733
|
+
}, config?: {
|
|
734
|
+
x?: number;
|
|
735
|
+
y?: number;
|
|
736
|
+
size?: number;
|
|
737
|
+
strokeStyle?: string;
|
|
738
|
+
lineWidth?: number;
|
|
739
|
+
i?: number;
|
|
740
|
+
j?: number;
|
|
741
|
+
phase?: boolean;
|
|
742
|
+
context?: CanvasRenderingContext2D;
|
|
743
|
+
}) => number[][];
|
|
577
744
|
const rOplane: (config: {
|
|
578
745
|
x: number;
|
|
579
746
|
y: number;
|
|
@@ -631,6 +798,11 @@ declare namespace Chalkboard {
|
|
|
631
798
|
const fromAxis: (vect: ChalkboardVector, rad: number) => ChalkboardQuaternion;
|
|
632
799
|
const init: (a: number, b?: number, c?: number, d?: number) => ChalkboardQuaternion;
|
|
633
800
|
const invert: (quat: ChalkboardQuaternion) => ChalkboardQuaternion;
|
|
801
|
+
const isApproxEqual: (quat1: ChalkboardQuaternion | number, quat2: ChalkboardQuaternion | number, precision?: number) => boolean;
|
|
802
|
+
const isEqual: (quat1: ChalkboardQuaternion | number, quat2: ChalkboardQuaternion | number) => boolean;
|
|
803
|
+
const isInverse: (quat1: ChalkboardQuaternion | number, quat2: ChalkboardQuaternion | number, precision?: number) => boolean;
|
|
804
|
+
const isNormalized: (quat: ChalkboardQuaternion) => boolean;
|
|
805
|
+
const isZero: (quat: ChalkboardQuaternion | number) => boolean;
|
|
634
806
|
const mag: (quat: ChalkboardQuaternion) => number;
|
|
635
807
|
const magset: (quat: ChalkboardQuaternion, num: number) => ChalkboardQuaternion;
|
|
636
808
|
const magsq: (quat: ChalkboardQuaternion) => number;
|
|
@@ -656,10 +828,12 @@ declare namespace Chalkboard {
|
|
|
656
828
|
const absolute: (func: ChalkboardFunction) => ChalkboardFunction;
|
|
657
829
|
const add: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
658
830
|
const compose: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
659
|
-
const define: (
|
|
831
|
+
const define: (...rule: (((...x: number[]) => number) | ((...x: number[]) => number)[])[]) => ChalkboardFunction;
|
|
660
832
|
const Dirac: (num: number, edge?: number, scl?: number) => number;
|
|
661
833
|
const discriminant: (a: number, b: number, c: number, form?: "stan" | "vert") => number;
|
|
662
834
|
const div: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
835
|
+
const erf: (num: number) => number;
|
|
836
|
+
const Gamma: (num: number) => number;
|
|
663
837
|
const Heaviside: (num: number, edge?: number, scl?: number) => number;
|
|
664
838
|
const lerp: (p: [number, number], t: number) => number;
|
|
665
839
|
const linear: (x1: number, y1: number, x2: number, y2: number) => ChalkboardFunction;
|
|
@@ -669,7 +843,16 @@ declare namespace Chalkboard {
|
|
|
669
843
|
const log10: (num: number) => number;
|
|
670
844
|
const mul: (func1: ChalkboardFunction, func2: ChalkboardFunction) => ChalkboardFunction;
|
|
671
845
|
const negate: (func: ChalkboardFunction) => ChalkboardFunction;
|
|
672
|
-
const parse: (
|
|
846
|
+
const parse: (expr: string, config?: {
|
|
847
|
+
values?: Record<string, number>;
|
|
848
|
+
roundTo?: number;
|
|
849
|
+
returnAST?: boolean;
|
|
850
|
+
returnJSON?: boolean;
|
|
851
|
+
returnLaTeX?: boolean;
|
|
852
|
+
}) => string | number | {
|
|
853
|
+
type: string;
|
|
854
|
+
[key: string]: any;
|
|
855
|
+
};
|
|
673
856
|
const pingpong: (num: number, edge?: number, scl?: number) => number;
|
|
674
857
|
const polynomial: (...coeffs: number[]) => ChalkboardFunction;
|
|
675
858
|
const pow: (base: number | ChalkboardFunction, num: number) => number | ChalkboardFunction;
|
|
@@ -688,7 +871,7 @@ declare namespace Chalkboard {
|
|
|
688
871
|
const tetration: (base: number, num: number) => number | undefined;
|
|
689
872
|
const translate: (func: ChalkboardFunction, h?: number, v?: number) => ChalkboardFunction;
|
|
690
873
|
const val: (func: ChalkboardFunction, val: number | ChalkboardVector) => number | ChalkboardVector;
|
|
691
|
-
const zero: (type?: "
|
|
874
|
+
const zero: (type?: "scalar2d" | "scalar3d" | "scalar4d" | "vector2d" | "vector3d" | "vector4d" | "curve2d" | "curve3d" | "curve4d" | "surface3d") => ChalkboardFunction;
|
|
692
875
|
}
|
|
693
876
|
}
|
|
694
877
|
declare namespace Chalkboard {
|
|
@@ -774,12 +957,14 @@ declare namespace Chalkboard {
|
|
|
774
957
|
const empty: (...size: number[]) => ChalkboardTensor;
|
|
775
958
|
const fill: (element: number, ...size: number[]) => ChalkboardTensor;
|
|
776
959
|
const init: (...tensor: ChalkboardTensor[]) => ChalkboardTensor;
|
|
960
|
+
const isApproxEqual: (tens1: ChalkboardTensor, tens2: ChalkboardTensor, precision?: number) => boolean;
|
|
777
961
|
const isEqual: (tens1: ChalkboardTensor, tens2: ChalkboardTensor) => boolean;
|
|
778
962
|
const isRankEqual: (tens1: ChalkboardTensor, tens2: ChalkboardTensor) => boolean;
|
|
779
963
|
const isRankOf: (tens: ChalkboardTensor, rank: number) => boolean;
|
|
780
964
|
const isSizeEqual: (tens1: ChalkboardTensor, tens2: ChalkboardTensor) => boolean;
|
|
781
965
|
const isSizeOf: (tens: ChalkboardTensor, ...size: number[]) => boolean;
|
|
782
966
|
const isSizeUniform: (tens: ChalkboardTensor) => boolean;
|
|
967
|
+
const isZero: (tens: ChalkboardTensor) => boolean;
|
|
783
968
|
const mul: (tens1: ChalkboardTensor, tens2: ChalkboardTensor) => ChalkboardTensor;
|
|
784
969
|
const negate: (tens: ChalkboardTensor) => ChalkboardTensor;
|
|
785
970
|
const print: (tens: ChalkboardTensor) => void;
|
|
@@ -845,22 +1030,23 @@ declare namespace Chalkboard {
|
|
|
845
1030
|
const constrain: (vect: ChalkboardVector, range?: [number, number]) => ChalkboardVector;
|
|
846
1031
|
const copy: (vect: ChalkboardVector) => ChalkboardVector;
|
|
847
1032
|
const cross: (vect1: ChalkboardVector, vect2: ChalkboardVector) => ChalkboardVector;
|
|
848
|
-
const dimension: (vectORvectfield: ChalkboardVector |
|
|
1033
|
+
const dimension: (vectORvectfield: ChalkboardVector | ChalkboardFunction) => 2 | 3 | 4;
|
|
849
1034
|
const dist: (vect1: ChalkboardVector, vect2: ChalkboardVector) => number;
|
|
850
1035
|
const distsq: (vect1: ChalkboardVector, vect2: ChalkboardVector) => number;
|
|
851
1036
|
const dot: (vect1: ChalkboardVector, vect2: ChalkboardVector) => number;
|
|
852
1037
|
const empty: (dimension: 2 | 3 | 4) => ChalkboardVector;
|
|
853
|
-
const field: (p:
|
|
1038
|
+
const field: (p: (...x: number[]) => number, q: (...x: number[]) => number, r?: (...x: number[]) => number, s?: (...x: number[]) => number) => ChalkboardFunction;
|
|
854
1039
|
const fill: (num: number, dimension: 2 | 3 | 4) => ChalkboardVector;
|
|
855
1040
|
const fromAlternateToCartesian: (vect: ChalkboardVector, type: "polar" | "bipolar" | "cylindrical" | "spherical") => ChalkboardVector;
|
|
856
1041
|
const fromAngle: (rad1: number, rad2?: number) => ChalkboardVector;
|
|
857
1042
|
const fromCartesianToAlternate: (vect: ChalkboardVector, type: "polar" | "bipolar" | "cylindrical" | "spherical") => ChalkboardVector;
|
|
858
|
-
const fromField: (vectfield:
|
|
1043
|
+
const fromField: (vectfield: ChalkboardFunction, vect: ChalkboardVector) => ChalkboardVector;
|
|
859
1044
|
const fromVector: (vect: ChalkboardVector) => ChalkboardVector;
|
|
860
1045
|
const init: (x: number, y: number, z?: number, w?: number) => ChalkboardVector;
|
|
861
1046
|
const interpolate: (vect: ChalkboardVector, a: number, b: number, c?: number, d?: number) => ChalkboardVector;
|
|
1047
|
+
const isApproxEqual: (vect1: ChalkboardVector, vect2: ChalkboardVector, precision?: number) => boolean;
|
|
862
1048
|
const isDimensionEqual: (vect1: ChalkboardVector, vect2: ChalkboardVector) => boolean;
|
|
863
|
-
const isDimensionOf: (vectORvectfield: ChalkboardVector |
|
|
1049
|
+
const isDimensionOf: (vectORvectfield: ChalkboardVector | ChalkboardFunction, dimension: 2 | 3 | 4) => boolean;
|
|
864
1050
|
const isEqual: (vect1: ChalkboardVector, vect2: ChalkboardVector) => boolean;
|
|
865
1051
|
const isNormalized: (vect: ChalkboardVector) => boolean;
|
|
866
1052
|
const isOrthogonal: (vect1: ChalkboardVector, vect2: ChalkboardVector) => boolean;
|