The first part: Introduction to Algorithms
[1946:john von Neumann, Stan Ulam, and Nick Metropolis, all in the Los Alamos scientific Laboratory, cook up the Metropol is algorithm, also known as the Monte Carlo method.] John von Neumann,stan Ulam and Nick Metropolis, a three scientist at the National Laboratory of the United States in 1946, were invented as the Monte Carlo method. Its specific definition is: in the square to draw a side long one-metre square, in the square inside the arbitrary use of chalk to draw an irregular shape, now to calculate the area of the irregular graph, how to calculate the column? Monte Carlo method tells us to uniformly scatter N (n) in the square. is a large natural number of soybeans, and then count how many soybeans in this irregular geometry inside, for example, there are M, then the area of this strange shape is similar to the m/n,n, the more accurate the calculated value. Here we have to assume that the beans are on a plane and there is no overlap between them. (Isaac Soy is just a metaphor.) )
Part II: Algorithm features
The great thing about the Monte Carlo method is that when the problem of accuracy cannot be solved, the idea of "exhaustive" is used to simulate the solution. Applied in various fields. The essence is Simulation (simulation): The use of a large number of random inputs to produce various outputs; the probability distribution of the results is the "approximation" of the real distribution. Therefore, whether the input distribution is random (what the computer can do now is pseudo-random, and does not produce a true random distribution), the amount of input is sufficient, this process we become sampling random Variables, decide whether to "approximate" the key. This is often a matter of application.
Part III: Application and Practice: Computer pi
The Monte Carlo method can be used to generate approximate values near the pi. Shows a square element with a 1/4 circle, a point falling in the inner circle (the red dot), and a total of the points cast on the square (red and green dots): Pi/4. This process is called using the Monte Carlo method to simulate approximation of the pi actual value.
Java implementations:
1 ImportJava.util.Random;2 Public classpisimulation {3 4 Private StaticRandom rnd =NewRandom ();5 Public Static voidMain (String args[])6 {7 //Simulate Pi8 intiter = 10000*10000;//0.1billion9 intTotalin = 0;Ten for(inti=0;i<iter;i++) One { A Doublex =rnd.nextdouble (); - Doubley =rnd.nextdouble (); - if(incircle (x, y)) thetotalin++; - } -System.out.println ("Simulate pi:" + ((Double) totalin/iter*4)); - + } - + Public Static BooleanInCircle (DoubleXDoubleY//whether within the 1/4 Circle range A { at if((x*x+y*y) <=1) - return true; - return false; - } - } - inSimulate pi:3.14143168
numerical simulation and calculation of Pi
Although it may not be accurate for PI, this is a solution. When faced with a problem, the feasible solution is a breakthrough.
Practice: Application in the field of finance
The stochastic process theory is used to simulate the model, and the Monte Carlo method is used to do numerical simulation when necessary. For example, predicting future earnings and trends, of course, this is very superficial explanation, more detailed please read the following literature, is a classic,
Of course, a complex problem can not be solved by a Monte Carlo simulation, it requires a lot of other methods: such as stochastic process, machine learning related methods, game theory involved in the comprehensive application of the method.
Practice: Analog rainbow to simulate the generation of a rainbow using a probability experiment employing the Monte Carlo technique using Monte Carlo technology The Rainbow generation process is simulated based on the probabilistic model. Http://www.mathdemos.org/mathdemos/MCRain/MCRain.html
Part IV: Citations
- Http://www.lancaster.ac.uk/pg/jamest/Group/intro3.html
- http://blog.csdn.net/v_JULY_v/article/details/6127953
- Http://www.uta.edu/faculty/rcli/TopTen/topten.pdf
- Http://introcs.cs.princeton.edu/java/stdlib/StdDraw.java
- Http://www.rebeccapaton.net/rainbows/index.htm
- https://www.google.com/books?hl=zh-CN&lr=&id=aeAlBQAAQBAJ&oi=fnd&pg=PA1&ots=kLHdCmPN0q &sig=mbrjajxxdienfbzesqhn0rz6q1a#v=onepage&q&f=false
One of the top ten most influential algorithms of the 20th century: Monte Carlo method