1948年,香农提出了“信息熵”(shāng) 的概念,解决了对信息的量化度量问题。
信息熵的一般计算公式计算公式
 H(x)=E[I(xi)]=E[log2 1/p(xi)]=-ξp(xi)log2 p(xi)(i=1,2,..n)
信息熵越大,变量x的不确定性越大,也就是说homogeneity越小,把它搞清楚所需要的信息量也就越大。

下面来看一个很酷的利用信息熵证明素数有无穷多个的例子:

假设我们从所有不超过n的自然数中选取一个自然数N,N可以分解为m个质因式(不超过n的所有素数)的乘积:N= P1^c1 * P2^c2 * ...*Pm^cm.
然后我们得到2^Xi ≤ Pi^Xi ≤ N ≤ n 因此我们有 0 ≤ Xi ≤ log(n).
1.首先 log(n) = H(N)
证: H(N)=E[I(Ni)]= -(p(N1)*log p(N1) + p(N2)*log p(N2) +...+ p(Nn)*log p(Nn))
N有n种取值可能性,且p(N1)=p(N2)=p(Ni)=1/n,即取得每个值的可能性想等。
所以 H(N) = log(n) (这里的log指的都是以2为底的对数)

2. log(n) = H(N)
= H(X1, X2, ..., Xm) //(N与 (X1, X2, ..., Xm) 一一对应,因此他们的信息熵也想等)
≤ H(X1) + H(X2) + ... + H(Xm) //每个 Xi 独立取值可能会增大他们取值的范围
≤ log(log(n)+1) * m //每个 Xi 都可能取0到log(n)的所有值

最终我们得到 m ≥ log(n) / log(log(n)+1)
当n趋于无穷大时,不大于n的素数的个数m ≥ ln2(log(n)+1),即m也会死趋近于无穷的。
这样就证明了素数的个数是无穷的。


Read more...

Firstly,we give the hardware organization of a typical computer system:(click)


We have an executable file hello which is generated after compiling the c source file hello.c by gcc:

1.As we type the characters ./hello at the keyboard, the shell reads each one into a register of the CPU,and the stores it in main memory.(click)


2.After we typing the command ./hello and enter on the keyboard, the shell then loads the executable hello file by executing a sequence of instructions that copy the code and data from disk to main memory. It is accomplished using a technique known as DMA(Direct Memory Access).(click)


3.Once the code and data in the hello file are loaded into main memory, the processor starts to execute the machine-language instructions in the hello program's main routine. If it needs to print results or some words, say like "Hello World.", on the screen, the bytes in the string "Hello World." will be copied from memory to regiser, then to the display device.(click)





Some questions involved:
1.Controller and Adapter
Each I/O device is connected to the I/O bus through either a controller or an adapter.
Controller is chip sets in the device itself or on the system's main printed circuit board (motherboard).
Adapter is a card that plugs into a slots on the motherboard.
Their main purpose are both transfer informations back and forth between the I/O device and I/O bus.

2.why 32 bits CPU allows max 4G-sized main memory?
PC(program counter) is a word-sized storage device(or register) in CPU. It points at(contains the address of) some machine-language instructions in main memory.


Read more...
preload preload preload