Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Design-concepts-design-patterns Calculate Entropy using C++

Have Programming Question? Ask it here!
 
 
 


muna
Calculate Entropy using C++
0 Answer(s)      a year and 6 months ago
Posted in : Design concepts & design patterns


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

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Calculate Entropy using C++
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
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
Shannon Entropy Calculation  Hi, Can anyone help me to calculate shannon entropy without using Hashmap
Calculate factorial Using Recursion
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 and rectangular box using method overloading in java   calculate volume of cube, cylinder
oopengl on3d using c/c++ - Development process
oopengl on3d using c/c++  sir i want a programs on opengl in 3d using c/c++ language give me new one sir
Calculate Age using current date and date of birth
Calculate Age using current date and date of birth In this section you will learn how to calculate the age. For this purpose, through the code, we have prompted the user to enter current date and date of birth in a specified format. Now
creation button using objective c
creation button using objective c  creation button using objective c
Calculate Company's Sale using Java
Calculate Company's Sales Using Java In this section, you will learn how to calculate Company's sale. A company sales 3 items at different rates and details... of the week c) Average sale per day Here is the code: import java.io.
C calculate sum of first and last element of array
C calculate sum of first and last element of array In this section, you will learn how to calculate sum of first and last element from the array of five... enters the number. Then using the index of the array, we have found first
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  how 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  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  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   
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   
How automatically calculate age based on date of birth and current date using jsp and servlet?
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++
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++
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
calculate average
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
How to print the following output using c program
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
write a program to calculate volume of a cube, cylinder, rectangular box using method overloading
write a program to calculate volume of a cube  write a program to calculate volume of a cube, cylinder, rectangular box using method overloading  
Online exam using c# and SQL server
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
c++
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
calculate size of array
calculate size of array  Is it possible to calculate the size of array using pointers in Java
calculate average
calculate average   Design and write a java program to determine all... to the original number. abc = a^3 + b^3 + C^3 ( NOTE 407 is one of them) 2.Design and write a program and calculate your final average in this course. The details
c++
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
implementation of stacks using linked lists in c++
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++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser
Making 301 redirection by using <c:redirect>
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
C++
C++  Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3
Calculate Sales Tax using Java Program
Calculate Sales Tax using Java Program In this section, you will learn how to calculate the sales tax and print out the receipt details for the purchased items. To evaluate this, we have taken the following things into considerations: 1
calculate the time ..
calculate the time ..  [CODE] Elapsed Time Example <script type="text/javascript"> var startTime = null...="button" value="Calculate Difference" onclick="calculateTimeElapsed();" />
C++
C++  How can i write this in dev c
C++
C++  How can i write this in dev c
c#
c#  how to find out the size of the BMP image in C
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
How to calculate attending hours?
How to calculate attending hours?  I need to calculate attending hours of a employee in a day in my project to make their monthly salary . By using work starting time and ending time. How should I do it using Date class? Or any
c++
c++  write a programme that calculates the area and circumference of a rectangle
c#
c#  how to find out the size of the BMP image
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
How ro convert char into string using recursive function in c#??
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
Calculate the Sum of three Numbers
. In this section you will learn how to calculate the sum of three numbers by using three... Calculate the Sum of Three Numbers   ... how to calculate three integer number . First of all define class name "
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  Describe the principle advantages of deploying a linked list versus a static array when implementing a Queue or a Stack
c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values
C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me
 

 

 

DMCA.com