Rewrite one node. `frozen` is set inside the base of a NON-integer power: * there the reciprocal must NOT be converted, because `(b·sec[θ])^(1/2)` and * `(b·cos[θ]^-1)^(1/2)` disagree on the principal branch (the √ of a reciprocal * ≠ the reciprocal of the √ where the base is negative) — converti
( ce: ComputeEngine, e: Expression, frozen: boolean )
| 2589 | const ops = e.ops; |
| 2590 | if (!ops || ops.length === 0) return e; |
| 2591 | const newOps = ops.map((o) => mapTrigHeads(ce, o, map)); |
| 2592 | const newHead = map[e.operator] ?? e.operator; |
| 2593 | if (newHead === e.operator && newOps.every((o, i) => o === ops[i])) return e; |
| 2594 | return ce.function(newHead, newOps); |
| 2595 | } |
| 2596 | |
| 2597 | /** True if `u` contains a `Power(base, p)` whose base is LINEAR in `x` and |
| 2598 | * whose exponent `p` is a POSITIVE non-integer literal (`√(c+d·x)`, |
| 2599 | * `(c+d·x)^(3/2)`) — the linear-inner shape whose substitution reduction |
| 2600 | * (4.1.12 #81-86) lands an elementary sin/cos·poly antiderivative. Distinguishes |
| 2601 | * `√(c+d·x)` (kept active) from a reciprocal `b/x` / `(c+d·x)^(-1)` (negative |
| 2602 | * exponent ⇒ NOT matched ⇒ deactivated, so the reciprocal declines cleanly). */ |
| 2603 | function fractionalLinearInnerQ(u: Expression, x: string): boolean { |
| 2604 | // `√(c+d·x)` canonicalizes to a `Sqrt` head, not `Power`. |
| 2605 | if (u.operator === 'Sqrt' && u.ops && polyDegreeX(u.ops[0], x) === 1) |
| 2606 | return true; |
| 2607 | if (u.operator === 'Power' && u.ops) { |
| 2608 | const [base, exp] = u.ops; |
| 2609 | if (polyDegreeX(base, x) === 1 && exp.isNumberLiteral) { |
| 2610 | const e = exp.re; |
| 2611 | if (typeof e === 'number' && e > 0 && !Number.isInteger(e)) return true; |
| 2612 | } |
| 2613 | } |
| 2614 | return (u.ops ?? []).some((o) => fractionalLinearInnerQ(o, x)); |
| 2615 | } |
| 2616 | |
| 2617 | /** Active → inert: `Cos[x]` → `cos[x]`. Applied to integrands on driver entry. |
| 2618 | * |
| 2619 | * Rubi-faithful `DeactivateTrigAux` (with one deliberate CE refinement): a trig |
| 2620 | * head is deactivated when its argument is LINEAR in `x`, x-free, or a BARE |
| 2621 | * MONOMIAL `c+d·xᵏ`. A trig of a COMPOSITE nonlinear argument — a linear base |
| 2622 | * raised to a power (`Sin[a+b·(c+d·x)ⁿ]`, `Sin[a+b·√(c+d·x)]`) or a genuine |
| 2623 | * quadratic/polynomial (`Sin[a+b·x+c·x²]`) — is left ACTIVE, because the |
| 2624 | * substitution / completing-the-square rules that reduce such arguments to |
no test coverage detected