dynamical list problem
01-05-2019, 05:13 PM
Post: #19
 DavidM Senior Member Posts: 912 Joined: Dec 2013
RE: dynamical list problem
(01-03-2019 02:11 PM)peacecalc Wrote:  But Albert, you gave me the hint for a solution: Every value is a starting point of a new 5m distance, the only difficulty will be then values where are 5m is not arrived exactly (means: it is more then 5m).

@pier4r: Yes, I use the hp50g.

(01-05-2019 12:54 PM)Thomas Klemm Wrote:  Either calculate the partial sum of the times (as suggested by Albert) and then calculate the difference or then add up 5 time entries (as I suggested).
You will end up with the same result.

With the above in mind, DOSUBS could be a key part of your implementation. It "feeds" each contiguous subgroup of list elements to a subroutine for processing, then takes whatever you left on the stack and returns it to you in a new list.

Using a simple list for illustrative purposes, imagine that your data exists as follows:
$$\left \{ \ 1 \ 1 \ 1 \ 1 \ 1 \ 2 \ 2 \ 2 \ 2 \ 2 \ 3 \ 3 \ 3 \ 3 \ 3 \ \right \}$$

DOSUBS could be used to obtain a list of averages of each subgroup of 5 as follows:
Code:
«    5    « + + + + 5 / »    DOSUBS »

DOSUBS operates in a loop to "pre-load" the stack with (in this case) 5 elements from the source list, then runs the provided subroutine. This process is repeated until the final group of elements has been exhausted, and whatever your subroutine left on the stack is gathered into a new list result. If it helps to visualize the process, you can think of it this way:
Code:
1 1 1 1 1             « + + + + 5 / »   1 1 1 1 2           « + + + + 5 / »     1 1 1 2 2         « + + + + 5 / »       1 1 2 2 2       « + + + + 5 / »         1 2 2 2 2     « + + + + 5 / »           2 2 2 2 2   « + + + + 5 / » ... 3 3 3 3 3             « + + + + 5 / » <results count> →LIST

The result of the above code (assuming exact mode) is:
$$\left \{ \ 1 \ \frac {6} {5} \ \frac {7} {5} \ \frac {8} {5} \ \frac {9} {5} \ 2 \ \frac {11} {5} \ \frac {12} {5} \ \frac {13} {5} \ \frac {14} {5} \ 3 \ \right \}$$

...thus allowing you to conveniently perform the averaging using a "sliding window" of values from the source list.

The more challenging part, of course, is in converting your source data into the proper format before determining the averages.
 « Next Oldest | Next Newest »

 Messages In This Thread dynamical list problem - peacecalc - 01-02-2019, 04:36 PM RE: dynamical list problem - grsbanks - 01-02-2019, 06:08 PM RE: dynamical list problem - BruceH - 01-02-2019, 06:47 PM RE: dynamical list problem - peacecalc - 01-02-2019, 07:14 PM RE: dynamical list problem - pier4r - 01-03-2019, 11:56 AM RE: dynamical list problem - Albert Chan - 01-03-2019, 12:57 PM RE: dynamical list problem - peacecalc - 01-03-2019, 02:11 PM RE: dynamical list problem - Albert Chan - 01-03-2019, 03:13 PM RE: dynamical list problem - peacecalc - 01-03-2019, 04:25 PM RE: dynamical list problem - Thomas Klemm - 01-03-2019, 04:44 PM RE: dynamical list problem - Albert Chan - 01-03-2019, 05:18 PM RE: dynamical list problem - Thomas Klemm - 01-03-2019, 09:15 PM RE: dynamical list problem - peacecalc - 01-04-2019, 08:51 AM RE: dynamical list problem - BruceH - 01-04-2019, 01:21 PM RE: dynamical list problem - Albert Chan - 01-04-2019, 02:34 PM RE: dynamical list problem - Thomas Klemm - 01-04-2019, 11:57 AM RE: dynamical list problem - peacecalc - 01-05-2019, 09:48 AM RE: dynamical list problem - Thomas Klemm - 01-05-2019, 12:54 PM RE: dynamical list problem - DavidM - 01-05-2019 05:13 PM RE: dynamical list problem - Thomas Klemm - 01-05-2019, 07:45 PM RE: dynamical list problem - John Keith - 01-07-2019, 04:55 PM RE: dynamical list problem - Thomas Klemm - 01-07-2019, 08:29 PM

User(s) browsing this thread: 1 Guest(s)