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

Function runSymPy

benchmarks/audit/wester.ts:307–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305 if (c.op === 'gcd') {
306 const build = () => engine.expr(['PolynomialGCD', c.arg, c.arg2, c.varName]).evaluate();
307 const timeMs = timeit(build); const r = build();
308 if (r.operator === 'PolynomialGCD' || /Error/.test(r.toString())) return { status: 'unsolved', text: r.toString(), values: [], timeMs };
309 return { status: 'ok', text: r.toString(), values: POINTS.map((p) => numAt(engine, r, c.varName, p)), timeMs };
310 }
311 if (c.op === 'resultant') {
312 const build = () => engine.expr(['Resultant', c.arg, c.arg2, c.varName]).evaluate();
313 const timeMs = timeit(build); const r = build();
314 if (r.operator === 'Resultant') return { status: 'unsolved', text: r.toString(), values: [], timeMs };
315 const v = numOf(r);
316 return v == null ? { status: 'unsolved', text: r.toString(), values: [], timeMs } : { status: 'ok', text: r.toString(), values: [v], timeMs };
317 }
318 const head = c.op === 'factor' ? 'Factor' : c.op === 'expand' ? 'Expand' : null;
319 const build = () => head ? engine.expr([head, c.arg]).evaluate() : engine.expr(c.arg).simplify();
320 const timeMs = timeit(build); const r = build();

Callers 1

wester.tsFile · 0.70

Calls 4

mapMethod · 0.65
parseMethod · 0.65
errorMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected