**Question: C++ code to find Entropy **

Ads

Posted in : Design concepts & design patterns

consider a discrete memory less source with source s= { S0,S1,S2,S3} with probabilities P0=1/8 , P1= 1/8, P2=1/2 , P3=1/4 prove that h(s^3)=3h(s) using C++ program ? I try this but not true # include <iostream> # include <cmath> using namespace std; int main() { float S0,S1,S2,S3; float Hs,Hs3; float X_1,X_2,X_3,X_4,X_5,X_6,X_7,X_8,X_9,X_10,X_11,X_12,X_13,X_14,X_15,X_16; cout<<"Enter the first probability value : "<<endl; cin>>S0; cout<<"Enter the second probability value : "<<endl; cin>>S1; cout<<"Enter the third probability value : "<<endl; cin>>S2; cout<<"Enter the fourth probability value : "<<endl; cin>>S3; X_1=(S0*S0)*3.32*log10(1/(S0*S0)); X_2=(S0*S1)*3.32*log10(1/(S0*S1)); X_3=(S0*S2)*3.32*log10(1/(S0*S2)); X_4=(S0*S3)*3.32*log10(1/(S0*S3)); X_5=(S1*S0)*3.32*log10(1/(S1*S0)); X_6=(S1*S1)*3.32*log10(1/(S1*S1)); X_7=(S1*S2)*3.32*log10(1/(S1*S2)); X_8=(S1*S3)*3.32*log10(1/(S1*S3)); X_9=(S2*S0)*3.32*log10(1/(S2*S0)); X_10=(S2*S1)*3.32*log10(1/(S2*S1)); X_11=(S2*S2)*3.32*log10(1/(S2*S2)); X_12=(S2*S3)*3.32*log10(1/(S2*S3)); X_13=(S3*S0)*3.32*log10(1/(S3*S0)); X_14=(S3*S1)*3.32*log10(1/(S3*S1)); X_15=(S3*S2)*3.32*log10(1/(S3*S2)); X_16=(S3*S3)*3.32*log10(1/(S3*S3)); Hs = S0*3.32*log10(1/S0)+S1*3.32*log10(1/S1)+S2*3.32*log10(1/S2)+S3*3.32*log10(1/S3); Hs3=X_1+X_2+X_3+X_4+X_5+X_6+X_7+X_8+X_9+X_10+X_11+X_12+X_13+X_14+X_15+X_16; cout<<"The Entropy of entered probability is : "<<Hs<<endl; cout<<"The Entropy of entered probability is : "<<Hs3<<endl; cout<<endl; system ("pause"); return 0; }

Ads

View Answers

Ads

Related Tutorials/Questions & Answers:

Tutorials

Java
Spring
Hibernate
Struts
Training
dennis
Designing an NXSD
plotting of points inside a rectangle
C++
Where is the top site to buy swtor credits in 2014 new year?
how to open a file of .110 extension??
Photoshop tutorials
How to change the dropdown values based on other dropdown in itext pdf or in any other?
javascript
c++ programs
Peer to Peer Networks â?? implementing shared file system with support for search
c programming
c programming
c programming
Gallery Photo
C++ code to find Entropy
Calculate Entropy using C++
DESIGN PATTERNS
wdm optical networks
Design Patterns
How to set left and top positions of alert box using JQuery in the below code?
c code
c code
develope
a
pattern printing
want help regarding a project
Personal Loans
decrement
structures
memory allocation
Structures and unions
steps to install jasper in Eclipse with example
Class Loader
Class Loader
Problems in Stringtokenizer
Problems in Stringtokenizer
Problems in Stringtokenizer
SAP MM Study Material
struts 1.x
Tags in struts 1
Include tag example in Struts
SWING FRMES
SWING FRMES
memory layout
returning a value from Threads
Database
Training
Logic and Degin
online quiz

Ads

- Java Tutorials
- Java Code example
- Java Programming
- Java Beginners Examples
- Applet Tutorials
- Awt Tutorials
- Java Certification
- Interview Question
- Java Servlets Tutorial
- Jsp Tutorials
- Java Swing Tutorials
- JDBC Tutorial
- EJB Tutorials
- Java Server Faces (JSF) Tutorial
- WAP Tutorial
- Struts Tutorial
- JAXB Tutorial
- Spring FrameWork Tutorial
- SOA&Web Services Tutorials
- Bioinformatics Tutorials
- MySQL Tutorials
- JAVA DOM Tutorial
- XML Tutorial
- EAI Articles
- Many Programming Tutorials Links
- Tutorials Books
**Java Script Tutorial****Ajax Tutorial****Dojo Tutorials****Programming Books****Trainings****Flex****Ant****RDF**

Ads