Rubi PosQ[u] := PosAux[TogetherSimplify[u]] — the Together step is * semantic, not cosmetic: PosAux[a − bc/d] has First = a (positive form) * while the together'd (a·d − b·c)/d has First = −b·c (negative form). * Emulated with the asNumDen/expand rational normalizer.
(e: Expression)
| 1120 | // Mathematica's automatic Together would have flattened) |
| 1121 | const vals = args.map((a) => { |
| 1122 | const e = build(a, ctx); |
| 1123 | return realNum(e) ?? realNum(safeSimplify(e)) ?? ratConstant(e); |
| 1124 | }); |
| 1125 | for (let i = 0; i + 1 < vals.length; i++) { |
| 1126 | const a = vals[i]; |
| 1127 | const b = vals[i + 1]; |
| 1128 | if (a === null || b === null || !cmp(a, b)) return false; |
| 1129 | } |
| 1130 | return true; |
| 1131 | } |
| 1132 | |
| 1133 | function intCmp( |
no test coverage detected