Complex error (uncertainty) propogation with covariance matrix
Code: ""
Programming language: Python
DMelt Version 1. Last modified: 05/08/2015. License: Free
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.

""" This example is based on a Python code. It will not work in Java/Groovy"

import uncertainties
from uncertainties.umath import sin
from uncertainties import ufloat,AffineScalarFunc, ufloat_fromstr, umath

x=ufloat(1, 0.1)  # x = 1+/-0.1
print "2*x=",2*x
print "x**2=",x*x
print "sin(1+2*x)=",sin(1+2*x)
print "Derivative=",(2*x+1000).derivatives[x]
print "Correlations between variables are automatically handled"

print square.n , " +-", square.s  

print "Covariance and correlation matrices"
x = ufloat(1, 0.1)
y = -2*x+10
z = -3*x
covs = uncertainties.covariance_matrix([x, y, z])
print covs