Support for mulit character variable names + symbol tests
It is possible to use the evaluateTex function with symbols (a, b, c), but a symbol out of multiple characters like aa are seems to get tokenized to single character variables and therefore is unable to find the symbol a, though provided through the scope object like with {aa: 2}.
This PR introduces some tests to show, it's working with single char symbols and throw an "undefined symbol a" error when a multi char symbol is provided.
A simple workaround for now seems to just map the variable names to single char names, since single char symbols are working fine.
Maybe there is a problem with parsing of multiplications, since aa could be a variable, but also the shorthand form of a * a
I've closed the old PR.
This one handles multi-char variables also as variables. The tests show the successful handling of multi-char vars.
With the provided conversions, f.e.:
const vars = {a : bignumber(257), b : bignumber(936)};
const ans = math.evaluate('a/b + a/2', vars);
evaluates to 128.7745726495726495726495726495726495726495726495726495726495726 and
const vars = {a : 257, b : 936};
const ans = math.evaluate('a/b + a/2', vars);
evaluates to 128.7745726495726496.
So the precision is lost when using numbers. To have the full precision, one have to use the bignumber function explicitly for the variable values.