1. Trang chủ
  2. » Giáo án - Bài giảng

Phương Pháp Monte carlo

55 300 4

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 55
Dung lượng 3,37 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

The solution, in the case where the needle length is not greater than the width of the strips, can be used to design a Monte Carlo method for approximating the The problem in more mathem

Trang 1

Phương pháp Monte Carlo

Trang 2

Vùng đất Monte Carlo - Monaco

Trang 3

Monte Carlo Casino

Trang 4

 Nửa cuối thế kỷ 19, trên thế giới đã có rất nhiều người sử dụng phương pháp tung cây kim lên mặt bàn rồi đếm số lần nó cắt hai đường thẳng song song để xác định số 𝞹 =3.14

 Năm 1899, Rayleigh đã chỉ ra rằng, các “bước đi” ngẫu nhiên 1 chiều không có trở ngại có thể cho ta một nghiệm gần đúng của phương trình

vi phân dạng parabolic

Lịch sử phương pháp

Trang 5

 Đầu thế kỷ 20, các cơ sở nghiên cứu thống kể ở Anh đã sử dụng các kỹ thuật liên quan đến

phương pháp Monte Carlo ở dạng đơn giản

 In 1908 Student (W.S Gosset) sử dụng phương pháp thử đúng sai (sampling) để tìm ra hàm

phân bố của các hệ số tương quan (correlation coefficient)

 Cùng năm, Student đã sử dụng phương pháp trên để tìm ra hàm phân bố t-distribution, sử

dụng một vài phân tích giải tích đơn giản và

chưa hoàn chỉnh

Lịch sử phương pháp

Trang 6

 Phương pháp Monte Carlo thực sử được sử dụng như một công cụ nghiên cứu bắt đầu từ một dự án chế tạo bom nguyên tử trong thế chiến thứ II (dự án Manhattan)

 Xuất phát từ yêu cầu cần mô phỏng các bài toán có liên quan đến sự khuếch tán ngẫu

nhiên của neutron trong các vật liệu

 Khoảng năm 1948, Fermi, Metropolis và

Ulam đã thu được gần đúng các giá trị riêng của phương trình Schrodinger bằng phương pháp Monte Carlo

Lịch sử phương pháp

Trang 7

Dự án Manhattan

 Stanislaw Ulam phát minh ra một kỹ thuật để giải một vài dạnh phương trình vi phân sử dụng phương pháp xác xuất Điều thú vị ở chỗ, phương pháp này dự trên chò trơi bài trong casino

 Cái tên “Monte Carlo” được đặt bởi Nicholas Metropolis (cùng tham gia dự án Manhattan)

 Dự án Manhattan là dự án quy tụ các nhà bác học hàng đầu của Mỹ để chế tạo bom nguyên tử cho quân đồng minh Einstein cũng có liên quan gián tiếp trong dự án này

* Tham khảo: “Niềm vui khám phá” - NXB Trẻ

Trang 8

 Khoảng năm 1970, các lý thuyết mô phỏng

Monte Carlo nở rộ và được phát triển mạnh mẽ cho đến ngày nay

Lịch sử phương pháp

Trang 9

Các khái niệm xác xuất

Trang 10

Giới thiệu

 Phương pháp Monte Carlo (MC) là các kỹ thuật sử dụng số ngẫu nhiên

 MC là phương pháp rất tổng quát và có tính chính xác RẤT CAO.

 MC được ứng dụng nhiều bài toán: từ Vật

lý, Hoá học đến Kinh tế, Tài chính

Trang 11

Ví dụ

Tính số π

Trang 12

(x, y)

Khởi tạo: x = (random#)

Khởi tạo: y = (random#)

Tính: khoang_cach = sqrt (x^2 + y^2)

Điều kiện: if khoang_cach (less.than.or.equal.to) 1.0

Thực hiện: hits = hits + 1.0

Tính số π

Trang 13

40 Approximation of a function

routines to report the current time in an integer form, and we can use this integer

to construct an initial seed (Anderson, 1990) For example, most computers can

produce 0 ≤ t1 ≤ 59 for the second of the minute, 0 ≤ t2 ≤ 59 for the minute of

the hour, 0 ≤ t3 ≤ 23 for the hour of the day, 1 ≤ t4 ≤ 31 for the day of the month,

1 ≤ t5 ≤ 12 for the month of the year, and t6 for the current year in common era.Then we can choose

is an implementation of such an evaluation of π in Java

// An example of evaluating pi by throwing a dart into a // unit square with 0<x<1 and 0<y<1.

static int seed;

public static void main(String argv[]) { // Initiate the seed from the current time

GregorianCalendar t = new GregorianCalendar();

if ((seed%2) == 0) seed = seed-1;

// Throw the dart into the unit square int ic = 0;

for (int i=0; i<n; ++i) { double x = ranf();

double y = ranf();

if ((x*x+y*y) < 1) ic++;

} System.out.println("Estimated pi: " + (4.0*ic/n));

} public static double ranf() { }

}

Chương trình tính số Pi

Trang 14

40 Approximation of a function

routines to report the current time in an integer form, and we can use this integer

to construct an initial seed (Anderson, 1990) For example, most computers can

produce 0 ≤ t1 ≤ 59 for the second of the minute, 0 ≤ t2 ≤ 59 for the minute of

the hour, 0 ≤ t3 ≤ 23 for the hour of the day, 1 ≤ t4 ≤ 31 for the day of the month,

1 ≤ t5 ≤ 12 for the month of the year, and t6 for the current year in common era Then we can choose

is an implementation of such an evaluation of π in Java.

// An example of evaluating pi by throwing a dart into a // unit square with 0<x<1 and 0<y<1.

static int seed;

public static void main(String argv[]) { // Initiate the seed from the current time

GregorianCalendar t = new GregorianCalendar();

if ((seed%2) == 0) seed = seed-1;

// Throw the dart into the unit square

} public static double ranf() { }

}

Chương trình tính số Pi

Trang 15

Georges Louis Leclerc Comte de Buffon (07.09.1707.-16.04.1788.)

Bài toán cây kim Buffon

Trang 16

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

Bài toán cây kim Buffon

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Gọi x là khoảng cách từ tâm cây kim đến đường thẳng gần nhất Do

đó, hàm phân bố mật độ xác xuất của x trong khoảng từ 0 đến t/2 như sau:

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two strips?

Buffon's needle was the earliest problem in geometric probability to be solved; it can be solved using integral geometry The solution, in the case where the needle length is not greater than the width of the strips, can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines.

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Ngoài khoảng

Trang 17

Bài toán cây kim Buffon

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

This GIF image describes the solution

of Buffon's Needle Problem for the

"short needle" case

The two random variables, x and θ, are independent, so the joint probability density function is the product

The needle crosses a line if

Now there are two cases.

Case 1: Short needle

Case 2: Long needle

Suppose In this case, integrating the joint probability density function, we obtain:

where is the minimum between and

Thus, performing the above integration, we see that, when , the probability that the needle will cross a line is

or

Ngoài khoảng

Gọi 𝜃 là góc nhọn giữa cây kim và hai đường thẳng // Hàm phân bố xác xuất đồng nhất của góc 𝜃 trong khoảng từ 0 đến 𝞹/2 là:

Trang 18

Bài toán cây kim Buffon

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

This GIF image describes the solution

of Buffon's Needle Problem for the

"short needle" case

The two random variables, x and θ, are independent, so the joint probability density function is the product

The needle crosses a line if

Now there are two cases.

Case 1: Short needle

Case 2: Long needle

Suppose In this case, integrating the joint probability density function, we obtain:

where is the minimum between and

Thus, performing the above integration, we see that, when , the probability that the needle will cross a line is

or

Ngoài khoảng

Vì hai biến cố x và 𝜃 độc lập nên hàm phân bố mật độ xác xuất của cây kim sẽ cắt đường thẳng sẽ là tích của hai hàm phân bố nói trên:

Trang 19

Bài toán cây kim Buffon

This GIF image describes the solution

of Buffon's Needle Problem for the

"short needle" case

The two random variables, x and θ, are independent, so the joint probability density function is the product

The needle crosses a line if

Now there are two cases.

Case 1: Short needle

Case 2: Long needle

Suppose In this case, integrating the joint probability density function, we obtain:

where is the minimum between and

Thus, performing the above integration, we see that, when , the probability that the needle will cross a line is

or

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

Điều kiện để cây kim cắt một trong hai đường thẳng là:

Trang 20

Bài toán cây kim Buffon

This GIF image describes the solution

of Buffon's Needle Problem for the

"short needle" case

The two random variables, x and θ, are independent, so the joint probability density function is the product

The needle crosses a line if

Now there are two cases

Case 1: Short needle

Case 2: Long needle

Suppose In this case, integrating the joint probability densityfunction, we obtain:

Thus, performing the above integration, we see that, when , the probability that the needle will cross a lineis

or

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

Do đó, xác xuất để cây kim cắt hai đường thẳng sẽ là tích phân sau

Với giả thuyết là l ≤ t

Trang 21

Nếu chúng ta thả cây kim N lần và tính số lần nó cắt hai cạnh R ta được:

P = R / N

Từ đó suy ra:

𝞹 = 2 l N / Rt

Bài toán cây kim Buffon

The a needle lies across a line, while the b needle does not.

Buffon's needle

From Wikipedia, the free encyclopedia

In mathematics, Buffon's needle problem is a question first posed in

the 18th century by Georges-Louis Leclerc, Comte de Buffon:

Suppose we have a floor made of parallel strips of wood, each the

same width, and we drop a needle onto the floor What is the

probability that the needle will lie across a line between two

strips?

Buffon's needle was the earliest problem in geometric probability to be

solved; it can be solved using integral geometry The solution, in the

case where the needle length is not greater than the width of the strips,

can be used to design a Monte Carlo method for approximating the

The problem in more mathematical terms is: Given a needle of length dropped on a plane ruled with parallel

lines t units apart, what is the probability that the needle will cross a line?

Let x be the distance from the center of the needle to the closest line, let θ be the acute angle between the needle

and the lines

The uniform probability density function of x between 0 and t /2 is

The uniform probability density function of θ between 0 and π/2 is

Giả sử ta thả rơi ngẫu nhiên một cây kim chiều dài l vào giữa của

hai đường thẳng // cách nhau một khoảng cách là t

Trang 22

Bài toán cây kim Buffon

Trang 23

Thả 1 lần

Trang 24

Thả 11 lần

Trang 25

Thả 111 lần

Trang 26

Thả 1111 lần

Trang 27

Chương trình

Ngày đăng: 10/09/2014, 23:44

TỪ KHÓA LIÊN QUAN

w