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

Function mul

src/compute-engine/rubi/normal-form.ts:62–72  ·  view source on GitHub ↗
(ce: ComputeEngine, fs: Expression[])

Source from the content-addressed store, hash-verified

60}
61
62function mul(ce: ComputeEngine, fs: Expression[]): Expression {
63 let flat = fs.flatMap(factors).filter((f) => !f.isSame(1));
64 // WL Times auto-evaluation, which the Rubi corpus assumes:
65 // 0·u → 0, and same-base power collection (d·d → d², u^a·u^b → u^(a+b))
66 if (flat.some((f) => f.isSame(0))) return ce.Zero;
67 flat = collectPowers(ce, flat);
68 flat = collectSameExponent(ce, flat);
69 if (flat.length === 0) return ce.One;
70 if (flat.length === 1) return flat[0];
71 return ce._fn('Multiply', flat);
72}
73
74/** Fuse factors sharing a NON-NUMERIC exponent: aˣ·bˣ → (a·b)ˣ. Sound for the
75 * Rubi verification regime (positive-real parameters), and needed so a product

Callers 5

toTimesPowerFunction · 0.70
collectSameExponentFunction · 0.70
splitSignFunction · 0.70
determinantFunction · 0.50
inverseFunction · 0.50

Calls 4

collectPowersFunction · 0.85
collectSameExponentFunction · 0.85
isSameMethod · 0.65
_fnMethod · 0.65

Tested by

no test coverage detected