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

Function intFracPart

src/compute-engine/rubi/rubi-utils.ts:4239–4258  ·  view source on GitHub ↗
(
  u: Expression,
  ce: ComputeEngine,
  part: 'int' | 'frac'
)

Source from the content-addressed store, hash-verified

4237 : ce.function('Multiply', scalars);
4238 let atoms: TrigAtom[] = [{ coef: ce.One, kind: null, arg: ce.One }];
4239 for (const t of trigFactors) atoms = mulAtomsByTrig(ce, atoms, t.head, t.arg);
4240 // fold the term scalar into every atom's coefficient
4241 return atoms.map((a) => ({
4242 coef: scalar.isSame(1) ? a.coef : ce.function('Multiply', [scalar, a.coef]),
4243 kind: a.kind,
4244 arg: a.arg,
4245 }));
4246}
4247
4248/** Materialize a list of trig atoms as a canonical Add. */
4249function atomsToExpr(ce: ComputeEngine, atoms: TrigAtom[]): Expression {
4250 const terms = atoms.map((a) =>
4251 a.kind === null
4252 ? a.coef
4253 : ce.function('Multiply', [a.coef, ce.function(a.kind, [a.arg])])
4254 );
4255 if (terms.length === 0) return ce.Zero;
4256 if (terms.length === 1) return terms[0];
4257 return ce.function('Add', terms);
4258}
4259
4260/** ExpandTrigReduce for circular Sin/Cos: product-to-sum into a real-trig
4261 * linear combination. `deepExpand` first distributes products and expands

Callers 1

rubi-utils.tsFile · 0.85

Calls 7

ratPartsFunction · 0.85
truncMethod · 0.80
numberMethod · 0.65
evaluateMethod · 0.65
exprMethod · 0.65
functionMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected