Docsity

Introduction to MC-Computational Physics-Lecture Slides, Slides of Computational Physics

Partial preview of the text

Download Introduction to MC-Computational Physics-Lecture Slides and more Slides Computational Physics in PDF only on Docsity!

STOCHASTIC METHODS

Topic:

Introduction to MC

Computational Physics

Computational Physics

Email: [email protected]

Dr. Nasir

M Mirza,

Room A -

114, Department of Physics & Applied Mathematics,

Pakistan Institute of Engineering & Applied Sciences,

PIEAS,

P.O. Nilore, Islamabad, 45650 , Pakistan

Topics: ‰

Stochastic processes

Random variables

Linear Congruent Generators

Pdfs

and cdfs

Rejection Method

Metropolis methods

Sampling Techniques

Variance rejection techniques

Random Walks

Application to Radiation Transport

Introduction to Genetic Algorithms

Topics for the course

Recommended Text: M. H. Kalos, P.A. Whitlock,Monte Carlo Methods, Vol. I,John Wiley and Sons, NY.

Most of the methods used computational people are drawn fromthree areas of numerical mathods, namely from the

calculus of

differences,

from

linear algebra,

and from

stochastic methods.

Computational Methods

Difference calculus:

Here we use finite differences, as opposed to

infinitesimal differentials, as the elements of computation. Lanear algebra

is the second tributary to our methodological pool.

For

example,

by

employing

the

finite

difference

formalism

to

convert

a

partial

differential

equation

into

a

system

of

linear

equations, we end up with a matrix of coefficients that has its non- zero elements concentrated near the main diagonal.

Docsity.com

Stochastic

is statistics turned upside down.

Textbooks on statistics are in general concerned withprocedures that allow us to find and quantify certainregularities in a given heap of numbers. In

stochastic

these

statistical

properties

are

given

beforehand,

and

an

important

task

then

is

the

production

of

"random

numbers"

with

just

those

Computational Methods properties.

John von Neumann

John von Neumann (Margittai

Neumann János

Lajos)

(born December 28, 1903 in

Budapest

, Austria-Hungary;

died February 8, 1957 in Washington D.C.,

United States

)

was a

Hungarian

-born mathematician who made

contributions to quantum physics, functional analysis, settheory, topology,

economics

, computer science,

numerical analysis, hydrodynamics (of explosions), statistics

and many other mathematical fields as one of

history's outstanding mathematicians.

Most notably, von Neumann was a pioneer of the application ofoperator theory to

quantum mechanics

(see von Neumann algebra), a

member of the Manhattan Project the creator of

game theory

and the

concept of cellular automata. Along with

Edward Teller

and Stanislaw

Ulam, von Neumann worked out key steps in thermonuclear reactionsand the hydrogen bomb.

Stanis

ł

aw

Marcin

Ulam

Stanis

ł

aw

Marcin

Ulam

(

April 13

,

1909

-

May 13

,

1984

)

was a

Polish

mathematician

who participated in the

Manhattan Project

and proposed the

Teller–Ulam

design

of

thermonuclear weapons

. He also invented

nuclear

pulse propulsion

and developed a number of

mathematical tools in

number theory

,

set theory

,

ergodic

theory

, and

algebraic topology

.

He suggested the

Monte Carlo method

for evaluating complicated

mathematical

integrals

that arise in the theory of nuclear

chain reactions

(not knowing that

Fermi

and others had used a similar method earlier).

This suggestion led to the more systematic development of Monte Carloby Von Neumann,

Metropolis

, and others.

These methods

are a widely used class of computational

algorithms

for simulating

the behavior of various physical

and mathematical

systems.

They are stochastic, that is nondeterministic as they use randomnumbers as opposed to deterministic algorithms.

It is repetitive algorithms and the large number of calculationsare involved.

Monte Carlo is suited to calculation using a computer,

Monte Carlo (MC) Method

When is MC helpful? We have all the probabilities we need for the computation. But actually doing the computation is too hard. For example:

Integration in many dimensions

Optimization in many dimensions

Simulation

Some define the Monte Carlo method as a numerical stochasticmethod for statistical simulation which utilizes sequences ofrandom numbers to perform the simulation.

Monte Carlo (MC) Method The Monte Carlo method is also playing games of chancewhere behavior and outcomes can be used to study somenatural processes.

What is the

We usually consider it to be 3.14, but that’s not precise. Ludolf

von Ceulen

enumerated for 35 decimal places:

How to compute the circumference and the area of the circle? Everyone knows (or can find it in a clever mathematical book), thatthe length L and the area A of the circle are

r

L

π

2

=

2

r

A

π

=

Applications

Advantages of MC Methods:

Direct simulation: PDF vs. conventional differential equations

Discontinuous, multi-value, multi-dimension functions

Doesn't require significant memory or computation time

Easily to modified for more complex problem, always

providing a solution.

Disadvantages:

Convergence problem

Robust –

subtle effect can be lost

1

1.2 1.0 0.8 0.6 0.4 0.2 0.

x

2

+

y

2

=

1

O

C

Y

i

X

i

B

A

y(x)

x

It is related to the shaded area by following:

{

}

OABC

Area

Total

P

area

shaded

The

×

=

i

i

y

Y

≥

i

i

y

Y

<

hit or a miss can be easilydecided by the following if

it is a miss and

if it is a hit

Area Under the Curve

Docsity.com

Step 1:

Get two random numbers for X

i

and Y

i

representing the

abscissa and ordinate of impact point of the dart such that

X

i

& Y

i

both reside in [0, 1] domain. Step 2:

Then compare the Y

i

with the value of y

i

corresponding to

X

i

. If the conditions are satisfied we register a hit.

Step 3:

Then calculate the probability, P using above equation.

Step 4:

Repeat N times the step 1 through 3.

Step 5:

Then compute the area under the curve. The total area of

the circle with radius one and center at origin, is four times thisarea.

Area Under the Curve

Docsity.com

Fig. The hitting dartswithin the circle areshown as small circlesand the star symbol isused for darts fallingoutside.

-0.

-0.

-0.

-0.

0

1

-0.2 -0.4 -0.6 -0.

0

0.8 0.6 0.4 0.

1

x

y

MC method: Area Under the Curve

Docsity.com

N = 100; delta = 1.0/N; rand('state', 0)

% initialize the state zero

probability(1) = 1; area(1)= 3.; xn(1)= N;

exact_area(1)=3.

for i = 2: 240

hit = 0; mis = 0;

for k = 1: N

x = rand;

y = rand;

if((xx + yy)<= 1 )**

hit = hit + 1;

else

mis = mis + 1;

end

end

probability(i) = hit/N; area(i) = 4probability(i); N = N + 100;*

xn(i) = N; exact_area(i) = 3.14156;

error(i) = 100(area(i) - exact_area(i));*

end

plot(xn, area, xn, exact_area)

MATLAB PROGRAM - 2:

Area Under the Curve