Search code examples
parsinggraph-algorithmgraphing

Equation Parser for Graphing in Javascript or Jquery


I want an Equation Parser so that it can solve for x as well as for y to get an array of points (i.e. x and y).

Example:

Let us assume a user enter the expression:

var expression ="x + y = 1";

Now let us say I know the domain and ranges:

var xMin = -10, yMin = -10, xMax = 10 ,yMax = 10;

So what I want is the plotting points between these ranges and domain.

Means I want an array or two dimensional array holding the value of x coordinates and y coordinates.

Please can anybody suggest me how to get up to here using any algorithm or a program.

Thanks in advance!


Solution

  • After parsing the equation to standard form, you could substitute different values depending on number of points required from the given range for one unknown variable i.e. for this example, say x and get corresponding y values.