# Javascript Function Parser

I just started working on the general-purpose function graphing engine. One of the desirable modes of operation is to be able to graph freeform functions, or functions specified in a calculator-like syntax (sometimes called infix notation).

This requires a special parser, which is now available in the new library as a standalone module. Usage is rather simple. Define the list of independent variables, then parse a specific function one time. The function may be evaluated at specific values of the independent variables as many times as desired after parsing.

For example:

__parser.set_variables( [“x”, “y”] );

var success = __parser.parse( “-3*sin(x/3) + 2*cos(y) + x^2 + 3*y” );

var value = __parser.evaluate( [4.0, 0.5] );

The variable named ‘value’ contains the function evaluated at x=4 and y=0.5.

I’m still on track to announce the library project this coming Friday.