Re: Position of Sign change in long list
- To: mathgroup at smc.vnet.net
- Subject: [mg18765] Re: [mg18691] Position of Sign change in long list
- From: "Hermann Meier" <hmeier at webshuttle.ch>
- Date: Tue, 20 Jul 1999 01:33:26 -0400
- Organization: EUnet AG
- References: <199907150546.BAA15968@smc.vnet.net.> <7mr4ua$8lg$1@dragonfly.wolfram.com>
- Sender: owner-wri-mathgroup at wolfram.com
The built-in function Position may be used: Module[{s = Sign[test], s1, cc}, s1 = First[s]; Position[s, cc_ /; cc != s1, 1, 1] // First // First] // Timing HM >> test=Table[Sin[Pi i/5000. +1],{i,10000}]; >> With[{st=Sign[test]},Length[Split[st][[1]]]] >> >> If you can think of a still faster or more elegant solution please let me >> know! >> >> Martin > > >
- References:
- Position of Sign change in long list
- From: "Martin Rommel" <rommel@semitest.com>
- Position of Sign change in long list