Evaluate a multi-variable `Solve` and return its tuples as arrays of numbers * (each coordinate numericized). Throws if the result is not a `List` of * `Tuple`s. Order is preserved.
(expr: BoxedExpression)
| 10 | * (each coordinate numericized). Throws if the result is not a `List` of |
| 11 | * `Tuple`s. Order is preserved. */ |
| 12 | function tuples(expr: BoxedExpression): number[][] { |
| 13 | const r = expr.evaluate(); |
| 14 | if (r.operator !== 'List') |
| 15 | throw new Error(`Expected a List, got ${r.operator}: ${r.toString()}`); |
| 16 | return r.ops!.map((t) => { |
| 17 | if (t.operator !== 'Tuple') |
| 18 | throw new Error(`Expected a Tuple, got ${t.operator}: ${t.toString()}`); |
| 19 | return t.ops!.map((o) => o.N().re); |
| 20 | }); |
| 21 | } |
| 22 | |
| 23 | /** True if the `Solve` expression stayed unevaluated (undecided / inert). */ |
| 24 | function isInert(expr: BoxedExpression): boolean { |
no test coverage detected