from uncertainties import ufloat
from uncertainties.umath import *
Paris_Lyon = ufloat((465,10))
Lyon_Nice = ufloat((479,10))
Paris_Nice = Paris_Lyon + Lyon_Nice
print Paris_Nice
944.0+/-14.142135623730951
# résultats en tenant compte de la rêgle des chiffres significatifs
print "%.f" % Pa_Nic.nominal_value,"+/-","%.f" % Pa_Nic.std_dev()
944 +/- 14
Lyon_Nice_Lyon = Lyon_Nice * 2
print Lyon_Nice_Lyon
958.0+/-20.0
print "%.f" % Ly_Nic_Ly.nominal_value,"+/-","%.f" % Ly_Nic_Ly.std_dev()
958 +/- 20
# si les 2 variables n'étaient pas corrélées (indépendantes)
x = ufloat((479,10))
y = ufloat((479,10))
test = x + y
print "%.f" % test.nominal_value,"+/-","%.f" % test.std_dev()
958 +/- 14