
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@cortex-js/compute-engine
Advanced tools
Symbolic computing and numeric evaluations for JavaScript and Node.js
MathJSON is a lightweight mathematical notation interchange format based on JSON.
The Cortex Compute Engine can parse LaTeX to MathJSON, serialize MathJSON to LaTeX, format, simplify and evaluate MathJSON expressions.
Reference documentation and guides at cortexjs.io/compute-engine.
$ npm install --save @cortex-js/compute-engine
import { parse, evaluate } from "@cortex-js/compute-engine";
const expr = parse("2^{11}-1 \\in \\P");
console.log(expr);
// ➔ ["Element", ["Subtract", ["Power", 2, 11] , 1], "PrimeNumber"]
console.log(evaluate(expr));
// ➔ "False"
This project is licensed under the MIT License.
0.25.1 2024-06-27
\frac{a^n}{a^m} = a^{n-m)
Rules can be defined using a new shorthand syntax, where each rule is a string of LaTeX:
expr.simplify(["\\frac{x}{x} -> 1", "x + x -> 2x"]);
Single letter variables are assumed to be wildcards, so x
is interpreted as
the wildcard _x
.
Additionally, the expanded form can also include LaTeX strings. The previous syntax using expressions can still be used, and the new and old syntax can be mixed.
For example:
expr.simplify([
{
match: "\\frac{x}{x}",
replace: "1"
},
{
match: ["Add", "x", "x"],
replace: "2x"
}
]);
The condition
function can also be expressed as a LaTeX string.
expr.simplify([ { match: "\\frac{x}{x}", replace: 1, condition: "x != 0" }, ]);
The shorthand syntax can be used any where a ruleset is expected, including with
the ce.rule()
function.
ce.getRuleSet()
method gives access to the built-in rules.Subtract
and Divide
function can now accept an arbitrary
number of arguments. For example, ["Subtract", 1, 2, 3]
is equivalent to
["Subtract", ["Subtract", 1, 2], 3]
.FAQs
Symbolic computing and numeric evaluations for JavaScript and Node.js
The npm package @cortex-js/compute-engine receives a total of 34,508 weekly downloads. As such, @cortex-js/compute-engine popularity was classified as popular.
We found that @cortex-js/compute-engine demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.