(node: Expression)
| 1528 | * |
| 1529 | * Returns the roots of the resulting sqrt-free equation (to be validated by the |
| 1530 | * caller against the original), or `null` when `expr` does not contain exactly |
| 1531 | * one distinct x-dependent square root, contains another radical of x, or is not |
| 1532 | * a polynomial in that root. |
| 1533 | */ |
| 1534 | function solveSingleSqrtEquation( |
| 1535 | expr: Expression, |
| 1536 | variable: string, |
| 1537 | trace?: RuleSteps, |
| 1538 | stats?: RootStats |
| 1539 | ): ReadonlyArray<Expression> | null { |
| 1540 | const ce = expr.engine; |
| 1541 | |
| 1542 | // Collect the distinct x-dependent radicals. Bail on anything other than a |
| 1543 | // single `Sqrt` (a second sqrt is the two-sqrt case; `Root` is unhandled). |
| 1544 | const sqrtKeys = new Set<string>(); |
| 1545 | let sqrtTerm: Expression | undefined; |
| 1546 | let radicand: Expression | undefined; |
| 1547 | let otherRadical = false; |
| 1548 | const scan = (node: Expression): void => { |
| 1549 | if (!node.has(variable)) return; |
no test coverage detected