JSPM

na-error-propagation

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q38679F
  • License MIT

Calculates the error propagation

Package Exports

  • na-error-propagation

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (na-error-propagation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

na-error-propagation

npm version bower version

Calculates the error propagation of an expression, also called Propagation of uncertainty.

Works in Node and the browser. Uses the nerdamer library to evaluate the expressions, including the differentials.

Example

Live Demo

var ErrorPropagation = require('na-error-propagation');
var nerdamer = require('nerdamer');
GLOBAL.nerdamer = nerdamer;
require('nerdamer/Calculus');
delete GLOBAL.nerdamer;
ErrorPropagation.nerdamer = nerdamer;

var errorPropagation = new ErrorPropagation({
  correlation: 'both'
});
errorPropagation.on('differential', function(diff) {
  console.log('differential', diff);
});
var result = errorPropagation.calculate('x + y', {
  x: {value: 8, error: 3},
  y: {value: 15, error: 4}
});
console.log('result', result); // {value: 23, error: {correlated: 10, uncorrelated: 5}}

If you want to use the events in the browser, you must set an EventEmitter library using the ErrorPropagation.setEventEmitter(EventEmitter) method.