Calculates the ratio between two independent numbers of events, and its error.
For a and b, that have statistical errors, sqrt(a) and sqrt(b),
ratio = a/b, and
error = a/b sqrt(1/a + 1/b)
| Stack | Before | After |
|---|---|---|
| t | - | destroyed |
| z | - | destroyed |
| y | a | error on ratio |
| x | b | ratio, a/b |
No registers are used.
No flags are used.
v1.00 May 20, 1991
00 { 22-Byte Prgm } ;
01 LBL "RATIO" ;
02 ENTER ; (x,y,z)=(b,b,a)
03 1/X ;
04 RCL ST Z ; (a, 1/b, b, a)
05 1/X ; (1/a, 1/b, b, a)
06 + ; (1/a+1/b, b, a)
07 SQRT ; (sqrt(1/a+1/b), b, a)
08 Rv ; (b, a, *, sqrt)
09 / ; (a/b, *, sqrt)
10 ENTER ; (a/b, a/b, *, sqrt)
11 R^ ; (sqrt, a/b, a/b, *)
12 x ; (sqrt*a/b, a/b, *)
13 X<>Y ; (a/b, error)
14 END
Programmed by Taku Yamanaka, May 20, 1991.