(ce: ComputeEngine, fs: Expression[])
| 60 | } |
| 61 | |
| 62 | function 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 |
no test coverage detected