Information Geometry
  • Home
  • About Us
  • Privacy Policy
  • Contact Us
Home  /  News  /  Additive versus non-additive property of entropy

Additive versus non-additive property of entropy

Frank March 17, 2010 News Comments are off

Shannon entropy is said additive in the sense that the entropy of the joint distribution

H(X*Y)

is the sum of the entropies:

H(X*Y) = H(X)+H(Y).

This property is not true for the quadratic entropy (sum of squares). The Java program below checks experimentally those entropy functional properties. Frank.

Here is the Java code

/*
 (C) March 2010, Frank Nielsen
 Demonstrates that Shannon entropy is additive
 and that the quadratic entropy is not
*/
public class ShannonAdditiveEntropy
{
 //quadratic entropy
public static double Q(double [] p)
{
double res=0.0d;
for(int i=0;i < p.length;i++)
    res+= p[i]*p[i];
    
return res;     
}   
 //Shannon entropy
public static double H(double [] p)
{
double res=0.0d;
for(int i=0;i < p.length;i++)
    res+= -p[i]*Math.log(p[i]);
    
return res;     
}   
    
public static void main (String [] args)
{
int n=10,i,j;
double sump=0.0, sumq=0.0;
double [] p=new double[n];
double [] q=new double[n];
double [] pq=new double[n*n];

for(i=0;i < n;i++)
{
p[i]=Math.random(); q[i]=Math.random(); 
sump+=p[i]; sumq+=q[i];
}
// normalize to densities
for(i=0;i < n;i++)
{
    p[i]/=sump;  q[i]/=sumq;
}

for(i=0;i < n;i++)
    for(j=0;j < n;j++)
     pq[i*n+j]=p[i]*q[j];
     
System.out.println("Show that Shannon entropy is an additive entropy:");
System.out.println("H(p)="+H(p)+" H(q)="+H(q)+" H(pq)="+H(pq) );
double delta=H(pq)-H(p)-H(q);
System.out.println("Additive entropy:"+delta);
System.out.println("Show that the quadratic entropy is NOT an additive entropy:");
System.out.println("Q(p)="+Q(p)+" Q(q)="+Q(q)+" H(pq)="+Q(pq) );
double deltaq=Q(pq)-Q(p)-Q(q);
System.out.println("Not an ddditive entropy:"+deltaq);
     
}
    
}

Frank.

Share this...
Share on facebook
Facebook
Share on pinterest
Pinterest
Share on twitter
Twitter
Share on linkedin
Linkedin
See also  How to Choose a General Contractor for a Custom Home
Previous Article
Next Article

About Author

Frank

Related Posts

  • Is Privacy.com Worth It? An Honest Review for 2026

    May 2, 2026
  • Why Early Childhood Education Matters: The Role of Childcare and Preschool in Belmore

    September 30, 2025
  • Start Strong: Study Support Services in Newcastle

    June 11, 2025

Recent Posts

  • What Is the PTE Academic Test? A Complete Guide for Australian Applicants
  • Advanced Concussion Care Solutions Offered in Melbourne Clinics
  • Is Privacy.com Worth It? An Honest Review for 2026
  • Practical Tips to Boost Your Child’s Confidence Before Childcare Starts
  • What Is PTE? The Complete Guide to the Pearson Test of English
  • How IT Support Services Help Businesses Stay Secure and Efficient
  • Why Early Childhood Education Matters: The Role of Childcare and Preschool in Belmore
  • Posture Correction Through Chiropractic: A Long-Term Solution
  • Start Strong: Study Support Services in Newcastle
  • How Internal Linking Impacts SEO and How to Check It Effectively

Archives

  • July 2026
  • June 2026
  • May 2026
  • November 2025
  • October 2025
  • September 2025
  • June 2025
  • May 2025
  • April 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • August 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • June 2010
  • May 2010
  • April 2010
  • March 2010
August 2026
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
« Jul    
  • What Is the PTE Academic Test? A Complete Guide for Australian Applicants
  • Advanced Concussion Care Solutions Offered in Melbourne Clinics
Theme by ThemesPie | Proudly Powered by WordPress