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

Function derivativeDivides

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

DerivativeDivides[y, u, x] — see block comment. Returns the x-free quotient * or the `False` symbol.

(y: Expression, u: Expression, ctx: Ctx)

Source from the content-addressed store, hash-verified

3082 if (!c.ops || polyDegreeX(c.ops[0], x) !== 1) return null;
3083 const coef =
3084 rest.length === 0
3085 ? t.engine.One
3086 : rest.length === 1
3087 ? rest[0]
3088 : t.engine.function('Multiply', rest);
3089 return { coef, arg: c.ops[0] };
3090 }
3091 return null;
3092}
3093
3094/** `a + b·cos[arg]` → `a + b·sin[arg + π/2]` when the base's only x-dependence
3095 * is a single linear-argument cosine (the standalone-cosine clause); else null. */
3096function cosBaseToSin(
3097 ce: ComputeEngine,
3098 base: Expression,
3099 x: string
3100): Expression | null {
3101 const terms = base.operator === 'Add' && base.ops ? base.ops : [base];
3102 let a = ce.Zero;
3103 let cosCoef: Expression | null = null;
3104 let cosArg: Expression | null = null;
3105 for (const t of terms) {
3106 if (!t.has(x)) {
3107 a = a.add(t);
3108 continue;
3109 }
3110 const parts = cosTermParts(t, x);
3111 if (parts === null) return null; // an x-dependent non-cosine term ⇒ not standalone
3112 if (cosArg === null) {
3113 cosCoef = parts.coef;

Callers 1

rubi-utils.tsFile · 0.85

Calls 10

polyDegreeXFunction · 0.85
polyCoeffsXFunction · 0.85
zeroQFunction · 0.85
easyDQFunction · 0.85
safeSimplifyFunction · 0.85
symbolMethod · 0.65
evaluateMethod · 0.65
functionMethod · 0.65
divMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected