Math::ErrorPropagation - Computes the error of a function of statistical data
use ErrorPropagation;
$x1 = Math::ErrorPropagation->datum(value=>1.2, var=>0.1); $x2 = Math::ErrorPropagation->datum(value=>2.3, var=>0.12); $x3 = Math::ErrorPropagation->datum(value=>3.5); $x3->sd(0.23);
$f = sin(0.5*$x1)/($x2**3)+log($x3); printf ("f = %f +/- %f", $f->central_value(), $f-sd());
A function f({X_i}) of a set of n independent stochastic variables {X_i}={X_0, X_1, ..., X_(n-1)} with means {x_i}={x_0, x_1, ..., x_(n-1)} and corresponding variances {var_i}={var_0, var_1, ..., var_(n-1)}, has mean f({x_i}) and a variance var_f which is the sum of the squared partial derivatives multiplied by the variances
var_f = (df/dx_i)**2 var_i
This package allows the propagation of errors on the variables through various simple mathematical operations to automatically compute the error of the function. Use it to define data each with a central (mean) value and either the variance or standard deviation (square root of the variance), then apply perls mathematical operators to them to calculate your function f. These operators are overloaded so that f automatically has the correct variance.
initialise a datum with mean 1.2 and variance 0.1
initialise an empty datum
assign a central value
assign a variance
assign a standard deviation
read the central value
read the variance
read the standard deviation
copy a datum
add data
increment datum
subtract data
decrement datum
multiply data
divide data
powers
some mathematical functions
Find bugs/flakiness.
Add more mathematical functions, particularly some of those in Math::Trig
Z. Sroczynski <zs@theorie.physik.uni-wuppertal.de>
perl.
To install Math::ErrorPropagation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::ErrorPropagation
CPAN shell
perl -MCPAN -e shell install Math::ErrorPropagation
For more information on module installation, please visit the detailed CPAN module installation guide.