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

Function simplerSqrtQ

src/compute-engine/rubi/rubi-utils.ts:2120–2141  ·  view source on GitHub ↗

Rubi SimplerSqrtQ[u,v] — is √u simpler than √v

(u: Expression, v: Expression)

Source from the content-addressed store, hash-verified

2118 };
2119 }
2120 }
2121 return null;
2122}
2123
2124function combineTriSum(
2125 u: { kind: 'bin'; p: BinParts } | { kind: 'tri'; p: TriParts },
2126 v: { kind: 'bin'; p: BinParts } | { kind: 'tri'; p: TriParts }
2127): { kind: 'bin'; p: BinParts } | { kind: 'tri'; p: TriParts } | null {
2128 // bin + bin → trinomial when one exponent doubles the other
2129 if (u.kind === 'bin' && v.kind === 'bin') {
2130 const { a: a3, b: b3, n: m } = u.p;
2131 const { a: a4, b: b4, n: k } = v.p;
2132 if (zeroQ(m.sub(k.mul(2))))
2133 return {
2134 kind: 'tri',
2135 p: { a: a3.add(a4).evaluate(), b: b4, c: b3, n: k },
2136 };
2137 if (zeroQ(k.sub(m.mul(2))))
2138 return {
2139 kind: 'tri',
2140 p: { a: a3.add(a4).evaluate(), b: b3, c: b4, n: m },
2141 };
2142 // same exponent merges to a binomial accumulator
2143 if (zeroQ(m.sub(k)))
2144 return {

Callers 1

rubi-utils.tsFile · 0.85

Calls 8

ltZeroFunction · 0.85
rtExprFunction · 0.85
isLiteralIntegerFunction · 0.85
realNumFunction · 0.85
isLiteralRationalFunction · 0.85
posQFunction · 0.85
leafCountFunction · 0.70
toStringMethod · 0.65

Tested by

no test coverage detected