By the Wolfram Documentation, ContourDetect gives a binary sparse array in which 1 corresponds to zeros and zero crossings in an array. However, in the example:
In[7]:= ContourDetect[{4, 0, 1, -2, 1, -2, -3, -1, 3}] // Normal
Out[7]= {0, 1, 1, 0, 1, 0, 0, 0, 1}
Why -2 at position 4 and 6 corresponds to 0s? Didn't we cross zero by going from 1 to -2? What makes a number in an array a zero crossing?
ListPlot[{#, ContourDetect[#] // Normal}, Joined -> True] &@{4, 0, 1, -2, 1, -2, -3, -1, 3}
as well as with other lists suggests, that0
is always replaced with1
. Apart from that, any pair of adjacent numbers{..., a, b, ...}
, wherea b
is strictly negative, is subject to a replacement where the negative number becomes a zero, and the positive - a one. $\endgroup$ContourDetect[Chop[N@list, 2]]
$\endgroup$