Rubi SimplerSqrtQ[u,v] — is √u simpler than √v
(u: Expression, v: Expression)
| 2118 | }; |
| 2119 | } |
| 2120 | } |
| 2121 | return null; |
| 2122 | } |
| 2123 | |
| 2124 | function 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 { |
no test coverage detected