3
$\begingroup$

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?

$\endgroup$
3
  • 1
    $\begingroup$ ListPlot[{#, ContourDetect[#] // Normal}, Joined -> True] &@{4, 0, 1, -2, 1, -2, -3, -1, 3} as well as with other lists suggests, that 0 is always replaced with 1. Apart from that, any pair of adjacent numbers {..., a, b, ...}, where a b is strictly negative, is subject to a replacement where the negative number becomes a zero, and the positive - a one. $\endgroup$
    – LLlAMnYP
    Commented Jun 8, 2016 at 15:43
  • $\begingroup$ What about ContourDetect[{4, 0, 1, -2, 1, -2, -3, -1, 3}, 2] for example? Does it find the places where the the array of points cross 2? $\endgroup$
    – amasics
    Commented Jun 9, 2016 at 22:05
  • $\begingroup$ No, what led you to think that way? That's equivalent to ContourDetect[Chop[N@list, 2]] $\endgroup$
    – LLlAMnYP
    Commented Jun 9, 2016 at 22:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.