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

Function simplerQ

src/compute-engine/rubi/rubi-utils.ts:1227–1246  ·  view source on GitHub ↗
(u: Expression, v: Expression)

Source from the content-addressed store, hash-verified

1225 for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] < b[i];
1226 return a.length < b.length;
1227}
1228
1229function collectSymbolLeaves(e: Expression, out: string[]): void {
1230 if (e.symbol) {
1231 out.push(e.symbol);
1232 return;
1233 }
1234 // monomial degree matters: a·d² keys as [a,d,d] (else it compares
1235 // equal-prefix-shorter against b·c·d and steals First[] from it)
1236 if (e.operator === 'Power' && e.ops) {
1237 const k = e.ops[1].re;
1238 if (e.ops[1].isInteger && typeof k === 'number' && k > 1 && k <= 16) {
1239 const inner: string[] = [];
1240 collectSymbolLeaves(e.ops[0], inner);
1241 for (let i = 0; i < k; i++) out.push(...inner);
1242 return;
1243 }
1244 }
1245 if (e.ops) for (const op of e.ops) collectSymbolLeaves(op, out);
1246}
1247
1248function mapList(arg: Json, ctx: Ctx, f: (u: Expression) => boolean): boolean {
1249 const items =

Callers 1

rubi-utils.tsFile · 0.85

Calls 5

isLiteralIntegerFunction · 0.85
realNumFunction · 0.85
ratPartsFunction · 0.85
leafCountFunction · 0.70
absMethod · 0.65

Tested by

no test coverage detected