View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Steffen Müller > Math-Symbolic-Custom-ErrorPropagation > Math::Symbolic::Custom::ErrorPropagation



Annotate this POD

View/Report Bugs
Module Version: 0.11   Source  


Math::Symbolic::Custom::ErrorPropagation - Calculate Gaussian Error Propagation


  use Math::Symbolic qw/parse_from_string/;
  use Math::Symbolic::Custom::ErrorPropagation;
  # Force is mass times acceleration.
  my $force = parse_from_string('m*a');
  # The measurements of the acceleration and the mass are prone to
  # statistical errors. (Hence have variances themselves.)
  # Thus, the variance in the force is:
  my $variance = $force->apply_error_propagation('a', 'm');
  print $variance;
  # prints:
  # (
  #   ((sigma_a ^ 2) * ((partial_derivative(m * a, a)) ^ 2)) +
  #   ((sigma_m ^ 2) * ((partial_derivative(m * a, m)) ^ 2))
  # ) ^ 0.5


This module extends the functionality of Math::Symbolic by offering facilities to calculate the propagated variance of a function of variables with variances themselves.

The module adds a method to all Math::Symbolic objects.

$ms_tree->apply_error_propagation( [list of variable names] )

This method does not modify the Math::Symbolic tree itself, but instead calculates and returns its variance based on its variable dependencies which are expected to be passed as arguments to this method in form of a list of variable names.

The variance is returned as a Math::Symbolic tree itself. It is calculated using the Gaussian error propagation formula for uncorrelated variances:

  variance( f(x_1, x_2, ..., x_n ) ) =
        variance(x_i)^2 * (df/dx_i)^2

In the above formula, the derivatives are partial derivatives and the component variances variance(x_i) are represented as "sigma_x_i" in the resulting formula. (The "x_i" is replaced by the variable name, though.)

Please refer to the SYNOPSIS for an example.


Please send feedback, bug reports, and support requests to one of the contributors or the Math::Symbolic mailing list.

List of contributors:

  Steffen M�ller, symbolic-module at steffen-mueller dot net


New versions of this module can be found on or CPAN.


Math::Symbolic::Custom, Math::Symbolic::Custom::Base,

syntax highlighting: