NumericJavascript model element

NumericJavascript provides access to the Numeric Javascript library created by Sébastien Loisel.

Usage

To add the NumericJavascript element to your model, drag the icon element to the list of your model elements.

The element declares a new global variable (object) called numerics which should be treated a reserved word in your simulation. You can use the functions of this library either as function of the new object numerics, or of the object named as your element (which is just an alias for numerics).

The element implements functions for :

Read the documentation for details.

Example of use

var out = numericJS.exp([1,2]); // creates an array with the two numbers [ e, e^2], where e = 2.7182818284...
var A = [[1,2,3],[4,5,6],[7,1,9]]; // Declares a 3x3 matrix 
var Ainv = numeric.inv(A); // Uses the element to compute the inverse of A
console.log("Ainv = "+Ainv); // should print  [[-0.9286,0.3571,0.07143],[-0.1429,0.2857,-0.1429],[0.7381,-0.3095,0.07143]]