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

Function invert

src/compute-engine/rubi/normal-form.ts:185–192  ·  view source on GitHub ↗

factors of 1/e in Times/Power form

(ce: ComputeEngine, e: Expression)

Source from the content-addressed store, hash-verified

183
184/** factors of 1/e in Times/Power form */
185function invert(ce: ComputeEngine, e: Expression): Expression[] {
186 if (e.operator === 'Multiply' && e.ops)
187 return e.ops.flatMap((o) => invert(ce, o));
188 if (e.operator === 'Power' && e.ops)
189 return [pow(ce, e.ops[0], negate(ce, e.ops[1]))];
190 if (isNumber(e) && e.isRational === true) return [ce.One.div(e).evaluate()];
191 return [ce._fn('Power', [e, ce.NegativeOne])];
192}
193
194/** Power constructor: merges (B^k)^e → B^(k·e) when sound (k = ±1 or
195 * e an integer), drops exponent 1. Also emulates Mathematica's input

Callers 1

toTimesPowerFunction · 0.85

Calls 6

isNumberFunction · 0.90
powFunction · 0.70
negateFunction · 0.70
evaluateMethod · 0.65
divMethod · 0.65
_fnMethod · 0.65

Tested by

no test coverage detected