Collect the distinct candidate generators `g(x)` occurring in `expr`, * innermost (shortest) first — so `ln x` is tried before `√(ln x)`.
(expr: Expression, x: string)
| 1769 | * 1. Isolate one sqrt: √(f(x)) = e - √(g(x)) |
| 1770 | * 2. Square: f(x) = e² - 2e√(g(x)) + g(x) |
| 1771 | * 3. Isolate remaining sqrt: f(x) - e² - g(x) = -2e√(g(x)) |
| 1772 | * 4. Square again: (f(x) - e² - g(x))² = 4e²·g(x) |
| 1773 | * 5. Expand: polynomial equation in x |
| 1774 | * 6. Solve and validate roots against original equation |
| 1775 | * |
| 1776 | * Returns solutions for x, or null if pattern not detected. |
| 1777 | */ |
| 1778 | function solveTwoSqrtEquation( |
| 1779 | expr: Expression, |
| 1780 | variable: string, |
| 1781 | trace?: RuleSteps, |
| 1782 | stats?: RootStats |
| 1783 | ): Expression[] | null { |
| 1784 | if (!isFunction(expr, 'Add')) return null; |
| 1785 | |
| 1786 | const ce = expr.engine; |
| 1787 | const ops = expr.ops; |
| 1788 | if (ops.length < 2) return null; |
no test coverage detected