[Tutor] Re: comparing seqs by successive intervals

Lee Harr missive at hotmail.com
Sun Jan 18 07:30:27 EST 2004


>I am trying to take some lists and compares them by measuring the
>intervals or gaps between each successive list item. I should also
>point out that everything here is modulo 12), so if we have a list like
>so:
>
>seq01 = [5, 7, 8, 11]
>
>the interval from list item 0 (5) to list item 1(7) is 2, item 1(7) to
>item 2 (8) is 1, and item 2 (8) to the last (11) is 3.
>
>seq02 = [1, 3, 4, 7]
>
>by this criteria seq02 would be the same as the intervals between each
>successive sequence item is the same:
>
>2-1-3
>


How about "normalizing" each list?

>>>seq01 = [5, 7, 8, 11]
>>>s01 = [s - seq01[0] for s in seq01]
>>>s01
[0, 2, 3, 6]
>>>seq02 = [1, 3, 4, 7]
>>>s02 = [s - seq02[0] for s in seq02]
>>>s02
[0, 2, 3, 6]

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail




More information about the Tutor mailing list