in reply to Re: Perl Drag Racing - sum/delta list
in thread Perl Drag Racing - sum/delta list
If the total is a+b+c+d, then the given data is (total, b-a, c-b, d-c). This means that the missing "original" a is total- (a+(b-a) + (a+(b-a))+(c-b) + ((a+(b-a))+(c-b))+(d-c))) divided by the number of elements.
Hmm, cancelling out, I see (b + c + d), but you are computing ( (b-a) + (c-b) + (d-c) ), the sum of the listed deltas. That gives you (d-a) which is the unknown first value (a) subtracted from the last value, which we don't know either.
It is a total coincedecne that the sum of the deltas happens to be the same as the difference between the first and last result elements.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Drag Racing - sum/delta list
by Aristotle (Chancellor) on Aug 17, 2002 at 17:24 UTC | |
by John M. Dlugosz (Monsignor) on Aug 19, 2002 at 19:02 UTC | |
by Aristotle (Chancellor) on Aug 19, 2002 at 23:36 UTC |