Doenet / math-expressions

Javascript library handling mathematical expressions involving transcendental functions
Other
48 stars 21 forks source link

Is this library compatible with mathJS? #31

Open corinnaSchultz opened 4 years ago

corinnaSchultz commented 4 years ago

I'm interested in finding out if I can use fromLatex() in combination with toString() to get a suitable input for mathJS.

Are these libraries compatible? Has anyone tested them for compatibility?

Example:

import { create, all } from 'mathjs'
math = create(all, {})
exp = MathExpression.fromLatex(myLatexMathString)
expStr = MathExpression.toString(exp)
evaluatedMath = math.evaluate(expStr)
markhats commented 4 years ago

This should be possible, although you can also evaluate without using math.js e.g.

const exp = MathExpression.fromLatex(myLatexMathString)
const evalFunc = exp.f()
const result = evalFunc([scope])