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  Should I See a Podiatrist or Physiotherapist for Sports Injury?
Previous Article
Next Article

About Author

Frank

Related Posts

  • How Small Business Accountants Can Help with Compliance and Regulations

    February 26, 2024
  • The Cost of Clean: Understanding the True Value of Professional House Cleaners for Healthier Living

    February 7, 2024
  • Dyslexia Tutoring Solutions in the Online Sphere

    Dyslexia Tutoring Solutions in the Online Sphere

    February 4, 2024

Recent Posts

  • Top Trends in Custom Mantels for Modern Homes
  • The Future of Cloud Computing: Trends to Watch in 2025
  • Creating Unforgettable Hens Party Bus Experiences in Melbourne
  • Skip Bin Hire: Tips to Avoid Common Pitfalls
  • Custom Metal Fabrication with CNC Machines: Unlocking Design Potential
  • Top Timeless Chairs to Elevate Your Home Decor
  • The Benefits of Accredited Art Therapy Courses
  • Why a Retreat on Kangaroo Island Is the Perfect Getaway
  • Maximising Your View: How Frameless Glass Pool Fencing Opens Up Melbourne Backyards
  • Selecting the Right Printing Company for Your Custom Printed Marquee

Archives

  • 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
February 2025
M T W T F S S
 12
3456789
10111213141516
17181920212223
2425262728  
« Jan    
  • Top Trends in Custom Mantels for Modern Homes
  • The Future of Cloud Computing: Trends to Watch in 2025
Theme by ThemesPie | Proudly Powered by WordPress