Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:27:51+00:00 2026-05-23T05:27:51+00:00

Mathematica’s Entropy function is order-dependent when using the SameTest option. That is: Entropy[RandomSample[Range[11]], SameTest->(Abs[#1-#2]>1&)

  • 0

Mathematica’s Entropy function is order-dependent when using the SameTest option.

That is:

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

will give different results many times.

I assume that this is because Entropy[] is in fact Union-izing the list, but, unlike Union, it is actually replacing one of the SameTest values with the other, and this replacement is order sensitive.

Is this a bug or is it the expected behaviour?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:27:52+00:00Added an answer on May 23, 2026 at 5:27 am

    You can see using Trace[ ] that the Entropy[ ] function ends up using Tally[ ] for counting the frequency of each state (numbers in this case).

    So for example

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

    calls

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

    which gives

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

    because it groups {1,3,4} and {2}

    But if you ask for

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

    you get

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

    because it groups {2,4} and {1,3}

    Resulting in a different states distribution (2,2) vs (3,1) before, and hence in a different entropy value.

    I think the problem arises because your SameTest is not partitioning the domain in two equivalence classes, as it should.

    Edit

    Just reformulating the last sentence:

    Mma assumes that

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

    which is not true in your case. For example

    2 === 4 && 4 === 1  but  2 !=== 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Solve function in Mathematica, we may get several solutions, e.g. In[1]:= Solve[x ==
I'm using Mathematica 7. I have an interpolated function, here's an example: pressures =
Mathematica has a function MapThread that behaves like this: MapThread[ f , { {a,b,c}
Using Mathematica, I have a list: l={0,0,0,1,2,0,0,0,1,0,0,0,2,0,0,0} I want to apply a function to
Is it true that Mathematica's Minimize function does not allow constraints like Mod[x,2]==0? I
Is there a Mathematica function that provides results equivalent to the unique() function in
Mathematica's list of built-in formats is pretty extensive; however, JSON is not on that
In Mathematica I have a list: x = {1,2,3,3,4,5,5,6} How will I make a
The problem is that I want to output Mathematica compatible floating point numbers. The
Mathematica notebooks are, of course, plaintext files -- it seems reasonable to expect that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.