Programmers mathematics (25) - probability preliminary

Today's headlines Search 三线城市程序员老陈video tutorials, or talk about technology and life, very welcome throat.

concept

Under certain circumstances, events may not occur may occur, called 随机事件.

For random event A, values which characterize the size of the likelihood of occurrence, called random event A 概率, denoted by P (A).

In general, if an experiment, there are n possible outcomes, and the likelihood of this occurring, etc. The results of n, m types of event A includes therein a result, then the probability of event A P (A) = m / n.

P (A) = 1, A is as necessarily event.
P (A) = 0, A is not possible for the event.

Determination of probability enumeration method

Toss two coins, find the probability of a positive and negative.

All results include: positive positive, positive and negative, anyway, counter-countermeasure, and the same results in the possibility of four.

Therefore, the probability of a positive and negative for P (A) = 2/4 = 0.5.

Estimate the probability of frequency

You can take advantage of repeated tests, estimated by statistical probability test results.

If the amount of data is large enough, strong enough computing performance, the frequency can be closer to probability, so the probability is very important principle programmers mathematics knowledge points.

According to long-term practice it found that the frequency can be a random incident, to estimate its probability.

For example, FIG, Sami particles to be drawing, hit by the number of grains in the circle / square number of hits is calculated π.

Here Insert Picture Description
S circle S positive How to form = Pi r 2 4 r 2 = Pi 4 \ Frac {S_ circle} {S _ {\ mathrm {square}}} = \ frac {\ mathrm {πr} ^ 2} {4r ^ 2} = \ frac {\ mathrm \ pi} 4

So if we sprinkle of rice enough, sufficiently uniform, then we can estimate the value of π by the number of hits in the circle / square hit.

Published 397 original articles · won praise 270 · views 550 000 +

Guess you like

Origin blog.csdn.net/woshisangsang/article/details/104458033