Hi Billy & Steve, | I have just a few minutes, but maybe can shed a little light on | this. I think this is the deal: | | The underlying math is simply that | INTEGRAL[x to b] = INTEGRAL[a to b] - INTEGRAL[a to x] | | The thing is, that this statement is true where x is a continuous variable. | Here we are on a discretized axis, where each value on our axis actually | represents a cell. As you move from low to high along the axis the running | sum is really the integral across that full cell. But the coordinate point | lies in the center of the cell (ignoring the complexities of irregular cell | sizes for this discussion). I've attempted to draw an axis to illustrate. | The carets ("^") show where the values is located on the axis in each case. | | direction of integration ==> | | 1 | 2 | 3 | 4 | 5 | 6 | | @RSUM ^ ^ ^ ^ ^ ^ | "correct" ^ ^ ^ ^ ^ ^ [. . .] I was about to send the following message, which (I think) says exactly the same thing as yours. But, I got stuck at the end. -------------------------------- I think the result Ferret gives is consistent "in a sense". Look at the attached plot. Let's assume that your function f(x) is defined as f(0.5) = 1 f(1.5) = 2 f(2.5) = 3 f(3.5) = 4 f(4.5) = 5 f(5.5) = 6 Then its integral F(x) from x = 0 to x = x is (or can be defined as) F(0) = 0 F(1) = 1 F(2) = 3 F(3) = 6 F(4) = 10 F(5) = 15 F(6) = 21 (F(i) = sum_{1 <= j <= i} f(j-0.5) delta-x .) Then, the most natural reverse integral G(x) = F(6) - F(x) is G(0) = 21 G(1) = 20 G(2) = 18 G(3) = 15 G(4) = 11 G(5) = 6 G(6) = 0 This is what you got, except that you don't have a gridpoint at x = 0. But . . . this makes me wonder: Shouldn't Ferret define @IIN at the right edges of the original gridpoints? In fact, @IIN is defined on the same gridpoints as the integrand. --------------------- Here's where I got stuck. So, my tentative conclusion is that in this sense, @RSUM and @IIN aren't quite equivalent. Ryo
Attachment:
reverse-integral.eps
Description: PostScript document