Are Entropy the result of an order dependency when using SameTest

The function of Mathematica Entropydepends on the order when using the option SameTest.

I.e:

Entropy[RandomSample[Range[11]], SameTest->(Abs[#1-#2]>1&) ]

will give different results many times.

I assume that this is because it Entropy[]is actually a Uniontwist of the list, but, unlike Union, it actually replaces one of the values SameTestwith another, and this replacement is an order of magnitude sensitive.

Is this a bug or is this the expected behavior?

+3
source share
1 answer

You can see, using Trace[ ]that function Entropy[ ]ends with using Tally[ ]to calculate the frequency of each state (numbers in this case).

So for example

 Entropy[{1,2,3,4}, SameTest->(Abs[#1-#2]>1&)]  

 Tally[{1,2,3,4}, SameTest->(Abs[#1-#2]>1&)]  

 -> {{1, 3}, {2, 1}}

{1,3,4} {2}

 Tally[{2,1,3,4}, SameTest->(Abs[#1-#2]>1&)]  

  -> {{2, 2}, {1, 2}}

{2,4} {1,3}

(2,2) vs (3,1) , , .

, - , SameTest , .

Edit

:

,

a === b && b === c  Implies a === c  

.

2 === 4 && 4 === 1  but  2 !=== 1
+2

All Articles