Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Position of Sign change in long list

  • To: mathgroup at
  • Subject: [mg18691] Position of Sign change in long list
  • From: "Martin Rommel" <rommel at>
  • Date: Thu, 15 Jul 1999 01:46:07 -0400
  • Sender: owner-wri-mathgroup at

I have a long list of data points and need to find the position where the
sign changes for the first time.
My first attempt was

test=Table[Sin[Pi i/5000. +1],{i,10000}];


which works, but is slow. It turns out that Min is relatively slow and
avoiding it can save time. The following is almost a factor 4 faster:


If you can think of a still faster or more elegant solution please let me


  • Prev by Date: Q: EPS fontsize
  • Next by Date: V4.0 Compatibility (Financial Derivatives book)
  • Previous by thread: Q: EPS fontsize
  • Next by thread: Re: Position of Sign change in long list