-1

I am using behalf of python 2.7 the module uncertainties. Who did ever type the following lines of code:

import uncertainties
counts = uncertainties.ufloat(1,1)
auto_correlator = (counts - counts) / (2 * counts)
print auto_correlator
#0.0+/-0

Do you wonder about the uncertainty of the result? I expect a finite error: 0.0+/-0.5 according to my understanding of statistics. The formula of error propagation that I used is the following:

Error Propagation Formula

I do not like to do it each time by hand. How can I propagate the error efficiently and reliable or is my intuition wrong?

strpeter
  • 2,562
  • 3
  • 27
  • 48
  • Which python library are you using? `uncertainities` is in no library I can currently think of, and obviously, this is relevant to your problem. Please edit your question to contain this info! – Marcus Müller Oct 19 '15 at 08:47
  • 1
    @MarcusMüller: I did not write the import statement correctly, forgive me please. The module exists! – strpeter Oct 19 '15 at 09:01
  • 1
    The uncertainty is zero, you are wrong. Why? Because they are all the same number. If you want three different number with same uncertainty, define three different numbers with same uncertainty. As is, they will cancel any difference in the subtraction because they are both the SAME number. – eri0o Oct 19 '15 at 09:10

2 Answers2

2

I think the result is fine. It doesn't matter how much counts is uncertain, counts - counts will always be exactly 0, because it is the same variable that is substracted from itself, we don't care about it's "real" value.

As @elric said in their comment, if you want the same "value" (i.e. same nominal value and same uncertainty), use different variables.

counts1 = uncertainties.ufloat(1,1)
counts2 = uncertainties.ufloat(1,1)
auto_correlator = (counts1 - counts2) / (counts1 + counts2)
print auto_correlator
Seb D.
  • 5,046
  • 1
  • 28
  • 36
2

If you use the same number, uncertainty of subtraction is zero. What you are thinking is different numbers with same uncertainty.

import uncertainties
counts1 =     uncertainties.ufloat(1,1)
counts2 = uncertainties.ufloat(1,1)
counts3 = uncertainties.ufloat(1,1)
not_auto_correlator = (counts1 - counts2) / (2 * counts3)
print not_auto_correlator
eri0o
  • 2,285
  • 4
  • 27
  • 43