Exemplo n.º 1
0
 function (base, derived) {
   let solved = {}
   for (let i = 0, len = base.length; i < len; i++) {
     const {key, value} = base[i]
     solved[key] = value
   }
   for (let i = 0, len = derived.length; i < len; i++) {
     const {key, value} = derived[i]
     solved[key] = Parser.evaluate(value, solved)
   }
   return solved
 }
 const createParser = function (computedColumn) {
   let formula = computedColumn.formula.replace(/col\[(\d+)\]/g, 'col$1');
   return Parser.parse(formula);
 };
Exemplo n.º 3
0
var h = require('h');
var expr = require('expr-eval');
var Plotly = require('plotly.js');
var css = require('insert-css');
var minimize = require('../');
var parser = new expr.Parser();
var mouseChange = require('mouse-change');
var transpose = require('transpose');

css(`
#graph {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
`);

var gd = window.gd = h('div#graph');
document.body.appendChild(gd);

var i, j;
var x = [];
var y = [];
var z = [];

var exprStr = '(1 + (x + y + 1)^2 * (19 - 14 * x + 3 * x^2 - 14 * y + 6 * x + y + 3 * y^2)) * (30 + (2 * x - 3 * y)^2 * (18 - 32 * x + 12 * x^2 + 48 * y - 36 * x * y + 27 * y^2))';
// var exprStr = '(1.5 - x + x * y)^2 + (2.25 - x + x * y^2)^2 + (2.625 - x + x * y^3)^2';
// var exprStr = '100 * (y - x^2)^2 + (x - 1)^2';
var f = parser.parse(exprStr);