Skip to content

Listing undefined symbols of a MathNode #2551

Answered by josdejong
zopieux asked this question in Q&A
Discussion options

You must be logged in to vote

In the parsed expression there is indeed no difference between functions and symbols, nor between functions/symbols defined in mathjs or in your scope. Some tips:

  • You can recognize function calls like sqrt and asin from symbols because they are defined as a FunctionNode having a property .fn being a SymbolNode with a .name property like sqrt or asin. You can use the third parent argument of node.traverse(function (node, path, parent) {...}) to check that.
  • Whether something is a built-in function of mathjs can be verified by checking whether say math.asin and math.pi are defined.
  • It is possible that a symbol is a unit like inch or millimeter, which will be resolved by mathjs when evaluati…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zopieux
Comment options

Answer selected by zopieux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants