Build `(coef·head[arg])^exp` (dropping a unit coefficient / exponent).
( ce: ComputeEngine, coef: Expression, head: string, arg: Expression, exp: Expression )
| 2838 | const shifted = cofunctionShiftRec(ce, e, x); |
| 2839 | if (hasDesyncedTargetArgs(shifted)) return e; // within-pair arg desync: revert |
| 2840 | return shifted; |
| 2841 | } |
| 2842 | |
| 2843 | // Reciprocal inert heads → negative power of their base cofunction: `csc→1/sin`, |
| 2844 | // `sec→1/cos`. Unlike Mathematica Rubi — which keeps `csc`/`sec` as distinct |
| 2845 | // inert heads and carries a full parallel family of `(b·csc)^n`/`(b·sec)^n` |
| 2846 | // rules — this port routes reciprocal-head integrands through the sine/cosine |
| 2847 | // POWER rules, which already handle negative exponents (`∫sin·cos^-5` closes |
| 2848 | // but `∫sin·sec^5` did not, because `sec` is an opaque head no `(d·cos)^n` |
| 2849 | // pattern matches). Rewriting the reciprocal to a negative power collapses |
| 2850 | // products like `sin·csc^5 → sin^-4` and exposes `cos·csc^5 → cos·sin^-5` to |
| 2851 | // the odd-power substitution, so the whole `(g cos)^p (a+b sin)^m (c+d sin)^n` |
| 2852 | // (§4.1.2.2) and bare `∫csc^n`/`∫sec^n` families close. Value-preserving. |
| 2853 | const RECIP_BASE: Record<string, string> = { csc: 'sin', sec: 'cos' }; |
no test coverage detected