After doing this:
Clear[f, h]
f[z_] = .66 I Cos[z];
h[c_] := {Re[c], Im[c], Nest[f, c, 200]};
complexpts =
Flatten[Table[a + b I, {a, 0., 8, 8/249}, {b, -4., 4, 8/249}], 1];
t1 = Map[h, complexpts] // Chop
This works:
Select[t1, Not[#[[3]] === Indeterminate] &]
But why doesn't this work:
Select[t1, Not[#[[3]] == Indeterminate] &]
And why doesn't this work:
Select[t1, (#[[3]] != Indeterminate) &]
Answer
=== (SameQ) is structural equality. a === b is True if a and b are exactly the same data structure (expressions), and False otherwise. For === it doesn't matter what a and b represent. Also, like nearly all Mathematica functions ending in Q, === always evaluates to either True or False (but nothing else).
== is mathematical equality. a == b represents the equality of two mathematical expressions. It may or may not evaluate to True or False. Equations are represented in terms of ==
Indeterminate == someNumber never evaluates in Mathematica. You end up with something that is neither False nor True in Select. Select treats that as if it were false. Compare Select[{1,2,3}, foo] where foo is an arbitrary symbol (not True or False). Also consider that Not[foo] doesn't evaluate (because foo is here treated as a yet-unknown logical variable).
Comments
Post a Comment