@cortex-js/compute-engine 0.20.1 → 0.20.2
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/compute-engine.esm.js +97 -70
- package/dist/compute-engine.js +97 -70
- package/dist/compute-engine.min.esm.js +9 -9
- package/dist/compute-engine.min.js +9 -9
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/public.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/domains.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +1 -1
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.20.
|
|
1
|
+
/** CortexJS Compute Engine 0.20.2 */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -17784,7 +17784,7 @@ var SIMPLIFY_RULES = [];
|
|
|
17784
17784
|
// src/compute-engine/function-utils.ts
|
|
17785
17785
|
function canonicalFunctionExpression(expr) {
|
|
17786
17786
|
if (expr.head === "N" && typeof expr.op1.head === "string") {
|
|
17787
|
-
const newHead = {
|
|
17787
|
+
const newHead = { Integrate: "NIntegrate", Limit: "NLimit" }[expr.op1.head];
|
|
17788
17788
|
if (newHead)
|
|
17789
17789
|
expr = expr.engine._fn(newHead, expr.op1.ops);
|
|
17790
17790
|
}
|
|
@@ -18255,6 +18255,11 @@ var BoxedFunction = class _BoxedFunction extends _BoxedExpression {
|
|
|
18255
18255
|
evaluate(options) {
|
|
18256
18256
|
if (!this.isValid)
|
|
18257
18257
|
return this;
|
|
18258
|
+
if (options?.numericMode) {
|
|
18259
|
+
const h = this.head;
|
|
18260
|
+
if (h === "Integrate" || h === "Limit")
|
|
18261
|
+
return this.engine.box(["N", this], { canonical: true }).evaluate(options);
|
|
18262
|
+
}
|
|
18258
18263
|
if (!this.isCanonical) {
|
|
18259
18264
|
this.engine.pushScope();
|
|
18260
18265
|
const canonical2 = this.canonical;
|
|
@@ -21085,71 +21090,6 @@ var ARITHMETIC_LIBRARY = [
|
|
|
21085
21090
|
evaluate: (ce, ops2) => evalSummation(ce, ops2[0], ops2[1], "evaluate"),
|
|
21086
21091
|
N: (ce, ops2) => evalSummation(ce, ops2[0], ops2[1], "N")
|
|
21087
21092
|
}
|
|
21088
|
-
},
|
|
21089
|
-
// Limits
|
|
21090
|
-
Limit: {
|
|
21091
|
-
description: "Limit of a function",
|
|
21092
|
-
complexity: 5e3,
|
|
21093
|
-
hold: "all",
|
|
21094
|
-
threadable: false,
|
|
21095
|
-
signature: {
|
|
21096
|
-
domain: [
|
|
21097
|
-
"FunctionOf",
|
|
21098
|
-
"Anything",
|
|
21099
|
-
"Numbers",
|
|
21100
|
-
["OptArg", "Numbers"],
|
|
21101
|
-
"Numbers"
|
|
21102
|
-
],
|
|
21103
|
-
N: (ce, ops2) => {
|
|
21104
|
-
const [f, x, dir] = ops2;
|
|
21105
|
-
const target = asFloat(x.N());
|
|
21106
|
-
if (target === null)
|
|
21107
|
-
return void 0;
|
|
21108
|
-
const fn = applicable(f);
|
|
21109
|
-
return ce.number(
|
|
21110
|
-
limit(
|
|
21111
|
-
(x2) => {
|
|
21112
|
-
const y = fn([ce.number(x2)])?.value;
|
|
21113
|
-
return typeof y === "number" ? y : Number.NaN;
|
|
21114
|
-
},
|
|
21115
|
-
target,
|
|
21116
|
-
dir ? asFloat(dir) ?? 1 : 1
|
|
21117
|
-
)
|
|
21118
|
-
);
|
|
21119
|
-
}
|
|
21120
|
-
}
|
|
21121
|
-
},
|
|
21122
|
-
NLimit: {
|
|
21123
|
-
description: "Numerical approximation of the limit of a function",
|
|
21124
|
-
complexity: 5e3,
|
|
21125
|
-
hold: "all",
|
|
21126
|
-
threadable: false,
|
|
21127
|
-
signature: {
|
|
21128
|
-
domain: [
|
|
21129
|
-
"FunctionOf",
|
|
21130
|
-
"Anything",
|
|
21131
|
-
"Numbers",
|
|
21132
|
-
["OptArg", "Numbers"],
|
|
21133
|
-
"Numbers"
|
|
21134
|
-
],
|
|
21135
|
-
evaluate: (ce, ops2) => {
|
|
21136
|
-
const [f, x, dir] = ops2;
|
|
21137
|
-
const target = asFloat(x.N());
|
|
21138
|
-
if (target === null)
|
|
21139
|
-
return void 0;
|
|
21140
|
-
const fn = applicable(f);
|
|
21141
|
-
return ce.number(
|
|
21142
|
-
limit(
|
|
21143
|
-
(x2) => {
|
|
21144
|
-
const y = fn([ce.number(x2)])?.value;
|
|
21145
|
-
return typeof y === "number" ? y : Number.NaN;
|
|
21146
|
-
},
|
|
21147
|
-
target,
|
|
21148
|
-
dir ? asFloat(dir) ?? 1 : 1
|
|
21149
|
-
)
|
|
21150
|
-
);
|
|
21151
|
-
}
|
|
21152
|
-
}
|
|
21153
21093
|
}
|
|
21154
21094
|
},
|
|
21155
21095
|
//
|
|
@@ -21820,6 +21760,73 @@ var CALCULUS_LIBRARY = [
|
|
|
21820
21760
|
}
|
|
21821
21761
|
}
|
|
21822
21762
|
}
|
|
21763
|
+
},
|
|
21764
|
+
{
|
|
21765
|
+
// Limits
|
|
21766
|
+
Limit: {
|
|
21767
|
+
description: "Limit of a function",
|
|
21768
|
+
complexity: 5e3,
|
|
21769
|
+
hold: "all",
|
|
21770
|
+
threadable: false,
|
|
21771
|
+
signature: {
|
|
21772
|
+
domain: [
|
|
21773
|
+
"FunctionOf",
|
|
21774
|
+
"Anything",
|
|
21775
|
+
"Numbers",
|
|
21776
|
+
["OptArg", "Numbers"],
|
|
21777
|
+
"Numbers"
|
|
21778
|
+
],
|
|
21779
|
+
N: (ce, ops2) => {
|
|
21780
|
+
const [f, x, dir] = ops2;
|
|
21781
|
+
const target = asFloat(x.N());
|
|
21782
|
+
if (target === null)
|
|
21783
|
+
return void 0;
|
|
21784
|
+
const fn = applicable(f);
|
|
21785
|
+
return ce.number(
|
|
21786
|
+
limit(
|
|
21787
|
+
(x2) => {
|
|
21788
|
+
const y = fn([ce.number(x2)])?.value;
|
|
21789
|
+
return typeof y === "number" ? y : Number.NaN;
|
|
21790
|
+
},
|
|
21791
|
+
target,
|
|
21792
|
+
dir ? asFloat(dir) ?? 1 : 1
|
|
21793
|
+
)
|
|
21794
|
+
);
|
|
21795
|
+
}
|
|
21796
|
+
}
|
|
21797
|
+
},
|
|
21798
|
+
NLimit: {
|
|
21799
|
+
description: "Numerical approximation of the limit of a function",
|
|
21800
|
+
complexity: 5e3,
|
|
21801
|
+
hold: "all",
|
|
21802
|
+
threadable: false,
|
|
21803
|
+
signature: {
|
|
21804
|
+
domain: [
|
|
21805
|
+
"FunctionOf",
|
|
21806
|
+
"Anything",
|
|
21807
|
+
"Numbers",
|
|
21808
|
+
["OptArg", "Numbers"],
|
|
21809
|
+
"Numbers"
|
|
21810
|
+
],
|
|
21811
|
+
evaluate: (ce, ops2) => {
|
|
21812
|
+
const [f, x, dir] = ops2;
|
|
21813
|
+
const target = asFloat(x.N());
|
|
21814
|
+
if (target === null)
|
|
21815
|
+
return void 0;
|
|
21816
|
+
const fn = applicable(f);
|
|
21817
|
+
return ce.number(
|
|
21818
|
+
limit(
|
|
21819
|
+
(x2) => {
|
|
21820
|
+
const y = fn([ce.number(x2)])?.value;
|
|
21821
|
+
return typeof y === "number" ? y : Number.NaN;
|
|
21822
|
+
},
|
|
21823
|
+
target,
|
|
21824
|
+
dir ? asFloat(dir) ?? 1 : 1
|
|
21825
|
+
)
|
|
21826
|
+
);
|
|
21827
|
+
}
|
|
21828
|
+
}
|
|
21829
|
+
}
|
|
21823
21830
|
}
|
|
21824
21831
|
];
|
|
21825
21832
|
|
|
@@ -23424,7 +23431,27 @@ var CORE_LIBRARY = [
|
|
|
23424
23431
|
signature: {
|
|
23425
23432
|
domain: ["FunctionOf", "Anything", "Anything"],
|
|
23426
23433
|
result: (_ce, ops2) => ops2[0].domain,
|
|
23427
|
-
canonical: (ce, ops2) =>
|
|
23434
|
+
canonical: (ce, ops2) => {
|
|
23435
|
+
if (ops2.length !== 1)
|
|
23436
|
+
return ce._fn("N", checkArity(ce, ops2, 1));
|
|
23437
|
+
const h = ops2[0].head;
|
|
23438
|
+
if (h === "N")
|
|
23439
|
+
return ops2[0].canonical;
|
|
23440
|
+
if (h === "Integrate") {
|
|
23441
|
+
const [index, lower, upper] = normalizeLimits(ops2[0].op2);
|
|
23442
|
+
if (!index || lower === void 0 || upper === void 0)
|
|
23443
|
+
return null;
|
|
23444
|
+
const fn = ops2[0].op1;
|
|
23445
|
+
return ce._fn("NIntegrate", [
|
|
23446
|
+
ce.box(["Function", fn, index]),
|
|
23447
|
+
ce.number(lower),
|
|
23448
|
+
ce.number(upper)
|
|
23449
|
+
]);
|
|
23450
|
+
}
|
|
23451
|
+
if (h === "Limit")
|
|
23452
|
+
return ce._fn("NLimit", ops2[0].ops);
|
|
23453
|
+
return ce._fn("N", ops2);
|
|
23454
|
+
},
|
|
23428
23455
|
evaluate: (_ce, ops2) => ops2[0].N()
|
|
23429
23456
|
}
|
|
23430
23457
|
},
|
|
@@ -28821,10 +28848,10 @@ function isFunctionValue(value) {
|
|
|
28821
28848
|
}
|
|
28822
28849
|
|
|
28823
28850
|
// src/compute-engine.ts
|
|
28824
|
-
var version = "0.20.
|
|
28851
|
+
var version = "0.20.2";
|
|
28825
28852
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
28826
28853
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
28827
|
-
version: "0.20.
|
|
28854
|
+
version: "0.20.2"
|
|
28828
28855
|
};
|
|
28829
28856
|
export {
|
|
28830
28857
|
ADDITION_PRECEDENCE,
|
package/dist/compute-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.20.
|
|
1
|
+
/** CortexJS Compute Engine 0.20.2 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var ComputeEngine = (() => {
|
|
4
4
|
var __create = Object.create;
|
|
@@ -17814,7 +17814,7 @@ var ComputeEngine = (() => {
|
|
|
17814
17814
|
// src/compute-engine/function-utils.ts
|
|
17815
17815
|
function canonicalFunctionExpression(expr) {
|
|
17816
17816
|
if (expr.head === "N" && typeof expr.op1.head === "string") {
|
|
17817
|
-
const newHead = {
|
|
17817
|
+
const newHead = { Integrate: "NIntegrate", Limit: "NLimit" }[expr.op1.head];
|
|
17818
17818
|
if (newHead)
|
|
17819
17819
|
expr = expr.engine._fn(newHead, expr.op1.ops);
|
|
17820
17820
|
}
|
|
@@ -18285,6 +18285,11 @@ var ComputeEngine = (() => {
|
|
|
18285
18285
|
evaluate(options) {
|
|
18286
18286
|
if (!this.isValid)
|
|
18287
18287
|
return this;
|
|
18288
|
+
if (options?.numericMode) {
|
|
18289
|
+
const h = this.head;
|
|
18290
|
+
if (h === "Integrate" || h === "Limit")
|
|
18291
|
+
return this.engine.box(["N", this], { canonical: true }).evaluate(options);
|
|
18292
|
+
}
|
|
18288
18293
|
if (!this.isCanonical) {
|
|
18289
18294
|
this.engine.pushScope();
|
|
18290
18295
|
const canonical2 = this.canonical;
|
|
@@ -21115,71 +21120,6 @@ var ComputeEngine = (() => {
|
|
|
21115
21120
|
evaluate: (ce, ops2) => evalSummation(ce, ops2[0], ops2[1], "evaluate"),
|
|
21116
21121
|
N: (ce, ops2) => evalSummation(ce, ops2[0], ops2[1], "N")
|
|
21117
21122
|
}
|
|
21118
|
-
},
|
|
21119
|
-
// Limits
|
|
21120
|
-
Limit: {
|
|
21121
|
-
description: "Limit of a function",
|
|
21122
|
-
complexity: 5e3,
|
|
21123
|
-
hold: "all",
|
|
21124
|
-
threadable: false,
|
|
21125
|
-
signature: {
|
|
21126
|
-
domain: [
|
|
21127
|
-
"FunctionOf",
|
|
21128
|
-
"Anything",
|
|
21129
|
-
"Numbers",
|
|
21130
|
-
["OptArg", "Numbers"],
|
|
21131
|
-
"Numbers"
|
|
21132
|
-
],
|
|
21133
|
-
N: (ce, ops2) => {
|
|
21134
|
-
const [f, x, dir] = ops2;
|
|
21135
|
-
const target = asFloat(x.N());
|
|
21136
|
-
if (target === null)
|
|
21137
|
-
return void 0;
|
|
21138
|
-
const fn = applicable(f);
|
|
21139
|
-
return ce.number(
|
|
21140
|
-
limit(
|
|
21141
|
-
(x2) => {
|
|
21142
|
-
const y = fn([ce.number(x2)])?.value;
|
|
21143
|
-
return typeof y === "number" ? y : Number.NaN;
|
|
21144
|
-
},
|
|
21145
|
-
target,
|
|
21146
|
-
dir ? asFloat(dir) ?? 1 : 1
|
|
21147
|
-
)
|
|
21148
|
-
);
|
|
21149
|
-
}
|
|
21150
|
-
}
|
|
21151
|
-
},
|
|
21152
|
-
NLimit: {
|
|
21153
|
-
description: "Numerical approximation of the limit of a function",
|
|
21154
|
-
complexity: 5e3,
|
|
21155
|
-
hold: "all",
|
|
21156
|
-
threadable: false,
|
|
21157
|
-
signature: {
|
|
21158
|
-
domain: [
|
|
21159
|
-
"FunctionOf",
|
|
21160
|
-
"Anything",
|
|
21161
|
-
"Numbers",
|
|
21162
|
-
["OptArg", "Numbers"],
|
|
21163
|
-
"Numbers"
|
|
21164
|
-
],
|
|
21165
|
-
evaluate: (ce, ops2) => {
|
|
21166
|
-
const [f, x, dir] = ops2;
|
|
21167
|
-
const target = asFloat(x.N());
|
|
21168
|
-
if (target === null)
|
|
21169
|
-
return void 0;
|
|
21170
|
-
const fn = applicable(f);
|
|
21171
|
-
return ce.number(
|
|
21172
|
-
limit(
|
|
21173
|
-
(x2) => {
|
|
21174
|
-
const y = fn([ce.number(x2)])?.value;
|
|
21175
|
-
return typeof y === "number" ? y : Number.NaN;
|
|
21176
|
-
},
|
|
21177
|
-
target,
|
|
21178
|
-
dir ? asFloat(dir) ?? 1 : 1
|
|
21179
|
-
)
|
|
21180
|
-
);
|
|
21181
|
-
}
|
|
21182
|
-
}
|
|
21183
21123
|
}
|
|
21184
21124
|
},
|
|
21185
21125
|
//
|
|
@@ -21850,6 +21790,73 @@ var ComputeEngine = (() => {
|
|
|
21850
21790
|
}
|
|
21851
21791
|
}
|
|
21852
21792
|
}
|
|
21793
|
+
},
|
|
21794
|
+
{
|
|
21795
|
+
// Limits
|
|
21796
|
+
Limit: {
|
|
21797
|
+
description: "Limit of a function",
|
|
21798
|
+
complexity: 5e3,
|
|
21799
|
+
hold: "all",
|
|
21800
|
+
threadable: false,
|
|
21801
|
+
signature: {
|
|
21802
|
+
domain: [
|
|
21803
|
+
"FunctionOf",
|
|
21804
|
+
"Anything",
|
|
21805
|
+
"Numbers",
|
|
21806
|
+
["OptArg", "Numbers"],
|
|
21807
|
+
"Numbers"
|
|
21808
|
+
],
|
|
21809
|
+
N: (ce, ops2) => {
|
|
21810
|
+
const [f, x, dir] = ops2;
|
|
21811
|
+
const target = asFloat(x.N());
|
|
21812
|
+
if (target === null)
|
|
21813
|
+
return void 0;
|
|
21814
|
+
const fn = applicable(f);
|
|
21815
|
+
return ce.number(
|
|
21816
|
+
limit(
|
|
21817
|
+
(x2) => {
|
|
21818
|
+
const y = fn([ce.number(x2)])?.value;
|
|
21819
|
+
return typeof y === "number" ? y : Number.NaN;
|
|
21820
|
+
},
|
|
21821
|
+
target,
|
|
21822
|
+
dir ? asFloat(dir) ?? 1 : 1
|
|
21823
|
+
)
|
|
21824
|
+
);
|
|
21825
|
+
}
|
|
21826
|
+
}
|
|
21827
|
+
},
|
|
21828
|
+
NLimit: {
|
|
21829
|
+
description: "Numerical approximation of the limit of a function",
|
|
21830
|
+
complexity: 5e3,
|
|
21831
|
+
hold: "all",
|
|
21832
|
+
threadable: false,
|
|
21833
|
+
signature: {
|
|
21834
|
+
domain: [
|
|
21835
|
+
"FunctionOf",
|
|
21836
|
+
"Anything",
|
|
21837
|
+
"Numbers",
|
|
21838
|
+
["OptArg", "Numbers"],
|
|
21839
|
+
"Numbers"
|
|
21840
|
+
],
|
|
21841
|
+
evaluate: (ce, ops2) => {
|
|
21842
|
+
const [f, x, dir] = ops2;
|
|
21843
|
+
const target = asFloat(x.N());
|
|
21844
|
+
if (target === null)
|
|
21845
|
+
return void 0;
|
|
21846
|
+
const fn = applicable(f);
|
|
21847
|
+
return ce.number(
|
|
21848
|
+
limit(
|
|
21849
|
+
(x2) => {
|
|
21850
|
+
const y = fn([ce.number(x2)])?.value;
|
|
21851
|
+
return typeof y === "number" ? y : Number.NaN;
|
|
21852
|
+
},
|
|
21853
|
+
target,
|
|
21854
|
+
dir ? asFloat(dir) ?? 1 : 1
|
|
21855
|
+
)
|
|
21856
|
+
);
|
|
21857
|
+
}
|
|
21858
|
+
}
|
|
21859
|
+
}
|
|
21853
21860
|
}
|
|
21854
21861
|
];
|
|
21855
21862
|
|
|
@@ -23454,7 +23461,27 @@ var ComputeEngine = (() => {
|
|
|
23454
23461
|
signature: {
|
|
23455
23462
|
domain: ["FunctionOf", "Anything", "Anything"],
|
|
23456
23463
|
result: (_ce, ops2) => ops2[0].domain,
|
|
23457
|
-
canonical: (ce, ops2) =>
|
|
23464
|
+
canonical: (ce, ops2) => {
|
|
23465
|
+
if (ops2.length !== 1)
|
|
23466
|
+
return ce._fn("N", checkArity(ce, ops2, 1));
|
|
23467
|
+
const h = ops2[0].head;
|
|
23468
|
+
if (h === "N")
|
|
23469
|
+
return ops2[0].canonical;
|
|
23470
|
+
if (h === "Integrate") {
|
|
23471
|
+
const [index, lower, upper] = normalizeLimits(ops2[0].op2);
|
|
23472
|
+
if (!index || lower === void 0 || upper === void 0)
|
|
23473
|
+
return null;
|
|
23474
|
+
const fn = ops2[0].op1;
|
|
23475
|
+
return ce._fn("NIntegrate", [
|
|
23476
|
+
ce.box(["Function", fn, index]),
|
|
23477
|
+
ce.number(lower),
|
|
23478
|
+
ce.number(upper)
|
|
23479
|
+
]);
|
|
23480
|
+
}
|
|
23481
|
+
if (h === "Limit")
|
|
23482
|
+
return ce._fn("NLimit", ops2[0].ops);
|
|
23483
|
+
return ce._fn("N", ops2);
|
|
23484
|
+
},
|
|
23458
23485
|
evaluate: (_ce, ops2) => ops2[0].N()
|
|
23459
23486
|
}
|
|
23460
23487
|
},
|
|
@@ -28851,10 +28878,10 @@ ${JSON.stringify(entry)}`
|
|
|
28851
28878
|
}
|
|
28852
28879
|
|
|
28853
28880
|
// src/compute-engine.ts
|
|
28854
|
-
var version = "0.20.
|
|
28881
|
+
var version = "0.20.2";
|
|
28855
28882
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
28856
28883
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
28857
|
-
version: "0.20.
|
|
28884
|
+
version: "0.20.2"
|
|
28858
28885
|
};
|
|
28859
28886
|
return __toCommonJS(compute_engine_exports);
|
|
28860
28887
|
})();
|