MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / getComplex

Function getComplex

src/compute-engine/boxed-expression/order.ts:546–570  ·  view source on GitHub ↗
(a: Expression)

Source from the content-addressed store, hash-verified

544 if (!isCommutative) return xs;
545
546 if (def.operator.commutativeOrder)
547 return [...xs].sort(def.operator.commutativeOrder);
548
549 return [...xs].sort(order);
550}
551
552/**
553 * Sort the terms of a polynomial expression (`Add` expression) according
554 * to the deglex polynomial ordering
555 *
556 */
557export function polynomialOrder(expr: Expression): Expression {
558 // Empirically, the Total Degree Reverse Lexicographic Order (grevlex)
559 // is often the fastest to calculate Gröbner basis. We use it as the
560 // default ordering for polynomials.
561 return degreeReverseLexicographicOrder(expr, expr.unknowns);
562}
563
564export function lexicographicOrder(
565 expr: Expression,
566 vars?: ReadonlyArray<string>
567): Expression {
568 // This ordering is not implemented yet; preserve the input expression.
569 const _vars = vars ?? expr.unknowns;
570 return expr;
571}
572
573export function degreeLexicographicOrder(

Callers 1

orderFunction · 0.85

Calls 3

isSymbolFunction · 0.90
isNumberFunction · 0.90
isFunctionFunction · 0.90

Tested by

no test coverage detected