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

Function functionOfQ

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

FunctionOfQ[v, u, x, pure] — restricted to the pure trig-substitution * targets this slice handles; false (decline) otherwise.

(
  ce: ComputeEngine,
  v: Expression,
  u: Expression,
  x: string,
  pure: boolean
)

Source from the content-addressed store, hash-verified

3477 const FALSE = ce.symbol('False');
3478 // Rubi: MatchQ[y, a_.*x /; FreeQ[a,x]] → False (degree-1 monomial, no
3479 // constant term: the trivial linear case handled by polynomial rules).
3480 const ydeg = polyDegreeX(y, x);
3481 if (ydeg === 1) {
3482 const yc = polyCoeffsX(y, x);
3483 if (yc !== null && yc.length === 2 && zeroQ(yc[0])) return FALSE;
3484 }
3485 // Rubi: If[PolynomialQ[y], PolynomialQ[u] && Exponent[u]==Exponent[y]-1,
3486 // EasyDQ[y]] — a hard gate before any differentiation.
3487 if (ydeg >= 0) {
3488 const udeg = polyDegreeX(u, x);
3489 if (!(udeg >= 0 && udeg === ydeg - 1)) return FALSE;
3490 } else if (!easyDQ(y, x)) {
3491 return FALSE;
3492 }
3493 const v = ce.function('D', [y, ce.symbol(x)]).evaluate();
3494 if (zeroQ(v)) return FALSE;
3495 let q = u.div(v); // canonical quotient: cos/cos → 1, sin⁴/(−sin) → −sin³
3496 if (!q.has(x)) return q;
3497 q = safeSimplify(q);
3498 if (!q.has(x)) return q;
3499 return FALSE;
3500}
3501

Callers 1

rubi-utils.tsFile · 0.85

Calls 4

substTrigNodeFunction · 0.85
activateTrigFunction · 0.85
pureFunctionOfTrigQFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected