import math # math.floor(x) returns the floor of x as a float, the largest integer value less than or equal to x. math.floor(9.2) 9.0 # math.sqrt(x) returns the square root of x. math.sqrt(81) 9.0 # math.pow(x,y) returns x raised to the power y. math.pow(2,3) 8.0 # math.log10(x) returns the base-10 logarithm of x. math.log10(100) 2.0 # math.exp(x) returns e**x. math.exp(2) 7.38905609893065 # check if the float x is a NaN math.isnan(x) # equivalent to the output of float('nan'). math.nan # python3 nan math. pi 3.141592653589793 math. e 2.718281828459045
The Bell System Technical Journal,Vol. 27, pp. 379–423, 623–656, July, October, 1948.A Mathematical Theory of Communication , By C. E. SHANNON 1 The fundamental problem of communication is that of reproducing at one point either exactly or approximately a message selected at another point. Frequently the messages have meaning; that is they refer to or are correlated according to some system with certain physical or conceptual entities. These semantic aspects of communication are irrelevant to the engineering problem. The significant aspect is that the actual message is one selected from a set of possible messages . The system must be designed to operate for each possible selection, not just the one which will actually be chosen since this is unknown at the time of design. 2 If the number of messages in the set is finite then this number or any monotonic function of this number can be regarded as a measure of the information produced when one message is chosen from the set, all choices being equally likely. As was pointed out by Hartley the most natural choice is the logarithmic function. Although this definition must be generalized considerably when we consider the influence of the statistics of the message and when we have a continuous range of messages, we will in all cases use an essentially logarithmic measure. 3 An information source which produces a message or sequence of messages to be communicated to the receiving terminal. The message may be of various types: (a) A sequence of letters as in a telegraph of teletype system; (b) A single function of time f (t) as in radio or telephony; (c) A function of time and other variables as in black and white television — here the message may be thought of as a function f (x;y; t) of two space coordinates and time, the light intensity at point (x;y) and time t on a pickup tube plate; (d) Two or more functions of time, say f (t), g(t), h(t)—this is the case in “threedimensional” sound transmission or if the system is intended to service several individual channels in multiplex; (e) Several functions of several variables—in color television themessage consists of three functions f (x;y; t), g(x;y; t), h(x;y; t) defined in a three-dimensional continuum—we may also think of these three functions as components of a vector field defined in the region — similarly, several black and white television sources would produce “messages” consisting of a number of functions of three variables; (f) Various combinations also occur, for example in television with an associated audio channel. 4. We may roughly classify communication systems into threemain categories: discrete,continuous and mixed . By a discrete system we will mean one in which both the message and the signal are a sequence of discrete symbols. A typical case is telegraphy where the message is a sequence of letters and the signal a sequence of dots, dashes and spaces. A continuous system is one in which the message and signal are both treated as continuous functions, e.g., radio or television. A mixed system is one in which both discrete and continuous variables appear, e.g., PCM transmission of speech. We first consider the discrete case . This case has applications not only in communication theory, but also in the theory of computing machines , the design of telephone exchanges and other fields. In addition the discrete case forms a foundation for the continuous and mixed cases which will be treated in the second half of the paper.