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

Function cosBaseToSin

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

`a + b·cos[arg]` → `a + b·sin[arg + π/2]` when the base's only x-dependence * is a single linear-argument cosine (the standalone-cosine clause); else null.

(
  ce: ComputeEngine,
  base: Expression,
  x: string
)

Source from the content-addressed store, hash-verified

2704//
2705// (a + b·sec[e+f·x])^n → (a + b·csc[e + π/2 + f·x])^n (no sign flip)
2706// (a + b·cot[e+f·x])^n → (a − b·tan[e + π/2 + f·x])^n (sign flip on b)
2707//
2708// These are pure functional identities — `sec θ = csc(θ+π/2)` and
2709// `cot θ = −tan(θ+π/2)` — so they are value-exact for EVERY power (integer or
2710// fractional; no branch hazard), which lets a bare node-level rewrite compose
2711// correctly through Add / Multiply / Power: reflecting the `sec`/`cot` LEAF
2712// carries the shift (and, for cot, the −1) into whatever binomial/product/power
2713// context encloses it. So `(a+b·sec)^m (c+d·sec)^n → (a+b·csc[+π/2])^m
2714// (c+d·csc[+π/2])^n` with a COMMON shifted argument, exactly matching the csc
2715// rule family. Verified: DeactivateTrig[Sqrt[b*Sec[x]],x] → Sqrt[b*csc[π/2+x]].
2716//
2717// Only LINEAR arguments are reflected (Rubi's `LinearQ[u[[1]],x]` guard in
2718// DeactivateTrigAux); an x-free or nonlinear-argument sec/cot is left as-is.
2719//
2720// LIMITATION vs. Rubi: a MIXED cross-pair integrand (e.g. `csc·cot`, a sec/csc
2721// factor times a tan/cot factor) needs Rubi's per-clause ±π/2 choice to land
2722// both factors on a COMMON argument; the uniform +π/2 leaf reflection here can
2723// leave their arguments differing by π/2. Those cases (4.5.1.4 (d tan)^n(a+b
2724// sec)^m and the like) also require the not-yet-bundled 4.3 Tangent rules, so
2725// they decline cleanly rather than mis-routing.
2726//
2727// The shifted `csc[·+π/2]` / `tan[·+π/2]` RESULT reads back cleanly: results are
2728// re-activated and run through `simplifyTrig`, whose PI_HALF_PLUS table already
2729// folds `Csc(θ+π/2)→Sec(θ)` and `Tan(θ+π/2)→−Cot(θ)` (see driver `cleanTrig`).
2730//
2731// SCOPE (R12): BOTH `sec→csc` and `cot→tan` are enabled by default (R12 bundled
2732// the 4.3 Tangent chapter that is the `cot→tan` reflection's target). The
2733// `cot→tan` reflection is the exact tan/cot mirror of `sec→csc`, and the SAME
2734// firing-scope guard makes it safe: the MIXED cross-pair 4.1 Sine
2735// `(g·cot)^p (a+b·sin)^m` families (4.1.1.3) carry a co-present `sin`/`cos`
2736// (a MIXED head — see MIXED_TRIG_HEADS below, which is auto-derived from
2737// COFUNCTION_SHIFT and now excludes both cofunction pairs), so `cofunctionShift`

Callers 1

unifyInertTrigFunction · 0.85

Calls 7

cosTermPartsFunction · 0.85
hasMethod · 0.65
addMethod · 0.65
isSameMethod · 0.65
functionMethod · 0.65
divMethod · 0.65
mulMethod · 0.65

Tested by

no test coverage detected