flatten a sum into its terms (Add/Subtract/Negate normalized)
(u: Expression)
| 1585 | |
| 1586 | /** structural monomial split u = coef·x^exp (coef and exp x-free; exp may |
| 1587 | * be symbolic). No expansion — mirrors Mathematica's literal matching of |
| 1588 | * a_.*x_^n_. terms over CE canonical form (Divide/Negate/Sqrt present). */ |
| 1589 | function monoPartsX( |
| 1590 | u: Expression, |
| 1591 | x: string |
| 1592 | ): { coef: Expression; exp: Expression } | null { |
| 1593 | const ce = u.engine; |
| 1594 | if (!u.has(x)) return { coef: u, exp: ce.Zero }; |
| 1595 | if (u.symbol === x) return { coef: ce.One, exp: ce.One }; |
| 1596 | const ops = u.ops; |
| 1597 | if (!ops) return null; |
no test coverage detected