MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / checkRadical

Function checkRadical

src/compute-engine/boxed-expression/factor.ts:345–357  ·  view source on GitHub ↗
(expr: Expression)

Source from the content-addressed store, hash-verified

343 }
344
345 const sqrt = extractSquareRoot(absTerm);
346 if (sqrt === null) return null;
347
348 results.push({ sqrt, isNegative: isNeg });
349 }
350
351 // We need exactly one positive and one negative square
352 const posSquares = results.filter((r) => !r.isNegative);
353 const negSquares = results.filter((r) => r.isNegative);
354
355 if (posSquares.length !== 1 || negSquares.length !== 1) return null;
356
357 const a = posSquares[0].sqrt;
358 const b = negSquares[0].sqrt;
359
360 // Pattern: a² - b² = (a-b)(a+b)

Callers 1

factorQuadraticFunction · 0.85

Calls 3

isNumberFunction · 0.90
isFunctionFunction · 0.90
hasNonTrivialRadicalFunction · 0.85

Tested by

no test coverage detected