# 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; }

View Answers

Ads

Related Tutorials/Questions & Answers:

Calculate Entropy using C++ # include <iostream> # include <cmath> using namespace std; int main() { float S0,S1,S2,S3; float...;"The Entropy of entered probability is : "<<Hs<<endl; cout<<

C++ code to find Entropy consider a discrete memory less source... 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

Advertisements

Shannon Entropy Calculation Hi, Can anyone help me to calculate shannon entropy without using Hashmap

Calculate factorial Using Recursion ...; Calculate factorial Using Recursion</font><br> <... through this example you will be understand how you can calculate the factorial

calculate volume of cube, cylinder and rectangular box using method overloading in java calculate volume of cube, cylinder and rectangular box using method overloading in java calculate volume of cube, cylinder

How to print the following output using c program 1) 4 3 4 2 3 4 1 2 3 4 2) A B C D E F G H I J

how to calculate addition of two distances in feets and inches using objects as functions arguments how to calculate addition of two distances in feets and inches using objects as functions arguments in java

Online exam using c# and SQL server hello, i'm making the (window based)online examination system using C#.net and SQL SERVER. my database is stored on server. my question is: if during the examination server gets failed

WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java

WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java

Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java

WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java

implementation of stacks using linked lists in c++ how to implementation of stacks using linked lists in c++ #include<stdio.h> #include<stdlib.h> #include<conio.h> struct node{ int data

c++ write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area

c++ .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70

Making 301 redirection by using How can i set the status as 301 when using tag? When i use , I am able to redirect to the desired URL (here, Google page) but I get 302 as the status of redirect. I need this status as 301. Any

How automatically calculate age based on date of birth and current date using jsp and servlet? when user enters the Date of birth in one textbox then automatically age will be display on another textbox. event:Onlick Event

c++ .write a prgrm tht accepts 5 subjects of a student,it shld hv a function to calculate the average & another function to grade.grade shld be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70

write a program to calculate volume of a cube write a program to calculate volume of a cube, cylinder, rectangular box using method overloading

How ro convert char into string using recursive function in c#?? This coding is for java...but i want this in c# How ro convert char into string using recursive function in c#?? char [] ch={'H','E','L','L','o'}; TO ans

C++ dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser

c++ Write the definition of the class dayType that implements... on an object of type dayType: a. Set the day. b. Print the day. c. Return the day. d. Return the next day. e. Return the previous day. f. Calculate and return

calculate average Question 2 cont.d Test case c: home works/labs 10 9 9 9 10 10 9 9 10 10 9 9 10 test scores: 65 89 note, the program should work with different numbers of home works/labs

C++ Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3

Create URL using <c:url> tag of JSTL Core tag library... to create a url according to the user's given parameter by using <c:url> tag... and click on submit button then <c:url> tag calculate the url with the given

calculate size of array Is it possible to calculate the size of array using pointers in Java

ModuleNotFoundError: No module named 'bob.paper.isba2018-entropy' Hi...: No module named 'bob.paper.isba2018-entropy' How to remove the ModuleNotFoundError: No module named 'bob.paper.isba2018-entropy' error? Thanks

ModuleNotFoundError: No module named 'commit-entropy' Hi, My... named 'commit-entropy' How to remove the ModuleNotFoundError: No module named 'commit-entropy' error? Thanks Hi, In your python