Recent Changes - Search:





This element lets you write an analytic expression for a function and use it to evaluate the function on given arguments.

The expressions are parsed to make the computations. Check here for the right syntax.

The expressions may contain any number of variables. To make the computation, you need to invoke the element evaluate() function with a Javscript object with all these variables as properties.

For instance, if your function element is called myFunction and the expression it contains is x+y, you can evaluate the function as in: var result = _view.myFunction.evaluate( { x : 3 , y : 2 } ); result should be 5.

If your expression contains many parameters (variables which rarely change their value), as in a*x^3+b*x^2+c*x+d, you can save the effort of passing each time the values of the parameters a,b,c,d, by setting: _view.myFunction.setParameters( { a : 1 , b : 3 , c : -1, d : -2 } ); and then evaluate the function by simply invoking: var result = _view.myFunction.evaluate( { x : 3 } ); The parameters do not change until you call setParameter again.

If you invoke once: var result = _view.myFunction.evaluate( { a : 0, x : 3 } ); then this value of a will be called for this particular evaluation. But the next time, the value of the parameter a will still be 1.

Edit - History - Print - Recent Changes - Search
Page last modified on August 26, 2013, at 02:18 PM