Open markhats opened 2 years ago
You can add new functions to the appliedFunctionSymbols argument when creating latexToAst or testToAst, which will parse "\myFunction(x)" (latex) or "myFunction(x)" (text) to the ast ["apply", "myFunction", "x"]. If that function is known to mathjs, then it will call the mathjs function when evaluating it. If producing latex, you also need to add it to allowedLatexSymbols of astToLatex so that the result going back to latex is "\myFunction(x)".
Thanks for the info.
I assume if it isn't a function known to mathjs, then I need to implement it as a custom mathjs function, as detailed here: https://mathjs.org/docs/core/extension.html ? Or is there a better way?
That's right. That's what I did to add some functions from numeric.js, and it seemed to work without a hitch.
Hi
Just wondered if there was a way to add custom math functions to the parsing and evaluation of expressions?
Thanks.