Ads

(adsbygoogle = window.adsbygoogle || []).push({});

Ads

(adsbygoogle = window.adsbygoogle || []).push({});

# 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

(adsbygoogle = window.adsbygoogle || []).push({});
// to set WMD's options programatically, define a "wmd_options" object with whatever settings
// you want to override. Here are the defaults:
wmd_options = {
// format sent to the server. Use "Markdown" to return the markdown source.
///output: "HTML",
output: "Markdown",
// line wrapping length for lists, blockquotes, etc.
lineLength: 40,
// toolbar buttons. Undo and redo get appended automatically.
buttons: "bold italic | link blockquote code image | ol ul heading hr",
// option to automatically add WMD to the first textarea found. See apiExample.html for usage.
autostart: true
};

Related Tutorials/Questions & Answers: