(
matches: RuleSteps,
via?: { because: string; form: Expression }
)
| 2169 | * Examples: `(ln x)² − 4 → ln x = ±2 → {e², e⁻²}`, |
| 2170 | * `√(ln x) = ln√x → {1, e⁴}`, `e^{2x} − 3e^x + 2 → {0, ln 2}`. |
| 2171 | * |
| 2172 | * Returns `null` when no single generator captures every occurrence of `x` |
| 2173 | * (e.g. `sin x − tan x`, which has two independent generators), or when the |
| 2174 | * reduced equation has no roots. |
| 2175 | */ |
| 2176 | function solveByGeneratorSubstitution( |
| 2177 | expr: Expression, |
| 2178 | x: string, |
| 2179 | depth: number, |
| 2180 | trace?: RuleSteps |
| 2181 | ): ReadonlyArray<Expression> | null { |
| 2182 | if (depth >= 3) return null; // recursion backstop |
| 2183 | const ce = expr.engine; |
| 2184 | |
| 2185 | const normalized = expandLogPowers(expr); |
| 2186 | for (const g of collectGenerators(normalized, x)) { |
no test coverage detected