Re: number of switches
- To: mathgroup at smc.vnet.net
- Subject: [mg47540] Re: number of switches
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 15 Apr 2004 03:40:46 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 4/14/04 at 7:16 AM, fake at fake.it (fake) wrote: >Consider the lists {1,1,0,1} and {1,1,0,0},{1,0,1,0,1}. The first >sequence (1101) switches 2 times (#2digit~#3digit, >#3digit~#4digit}, the second (1100) 1 time, the third 10101 4 >times. >I have the following problem. Consider a list of binary digits. >Which is the easiest way to count the number of switches of the >list (using Mathematica commands)? I don't know if the following is the "easiest way" but it works Count[Abs@ListConvolve[{1,-1},lst],1] where lst is the list of binary digits -- To reply via email subtract one hundred and four