I have a list of matrices
data= {{{23,3,4,5,20.5},{24,3,1,0,20.5},{25,3,7,8,20.5},{26,6,5,4,20.5}},{{23,4,5,3,20.4},{24,4,3,5,20.4},{26,4,3,2,20.4},{27,4,5,7,20.4},{28,4,3,2,20.4}},{{23,4,5,3,20.3},{24,4,3,5,20.3},{26,4,3,2,20.3},{27,4,5,7,20.3},{28,4,3,2,20.3},{29,0,0,2,20.3}},{{23,4,5,3,20.2},{24,4,3,5,20.2},{26,4,3,2,20.2},{30,4,5,7,20.2},{29,0,0,2,20.2}}}
Each matrix represents a collection of particles at a given time, each row represents a particle with its information {partice ID, x,y,z, time}
, the $(x,y,z)$ coordinates can be ignored for this problem. Particles can merge together and form a new particle, in which case the ID
of the more massive particle is retained on the merged particle.
I want to define a variable which counts the total number of NEW particle at each time. So in the given example, at time 20.5, I have 4 particles, at t=20.4 I have 2 new particles emerging, so now I have 6 particles at 20.4, at 20.3 I have 1 new halo emerging, so I have 7 particles, and again at 20.2 I have 1 new halo and so I have 8 particles. I want to have the final result as a table
{{20.5,4},{20.4,6},{20.3,7},{20.2,8}}
How do I do this? Thanks
EDIT : I was imagining, something like the Tally
function, but finds the distinct particle that arise at each time, so tally compared to the previous group of particles.
EDIT 2: The particle IDs are random numbers.