Session 13

Similar documents
6810 Session 13 (last revised: April 3, 2017) 13 1

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

TP 10:Importance Sampling-The Metropolis Algorithm-The Ising Model-The Jackknife Method

Monte Carlo method in solving numerical integration and differential equation

Review of Calculus, cont d

NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

Math 8 Winter 2015 Applications of Integration

CS667 Lecture 6: Monte Carlo Integration 02/10/05

Math 1B, lecture 4: Error bounds for numerical methods

Riemann Sums and Riemann Integrals

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Riemann Sums and Riemann Integrals

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Week 10: Line Integrals

n f(x i ) x. i=1 In section 4.2, we defined the definite integral of f from x = a to x = b as n f(x i ) x; f(x) dx = lim i=1

MA 124 January 18, Derivatives are. Integrals are.

Chapters 4 & 5 Integrals & Applications

1 Probability Density Functions

Continuous Random Variables

APPROXIMATE INTEGRATION

Review of basic calculus

Chapter 5. , r = r 1 r 2 (1) µ = m 1 m 2. r, r 2 = R µ m 2. R(m 1 + m 2 ) + m 2 r = r 1. m 2. r = r 1. R + µ m 1

The Regulated and Riemann Integrals

Numerical integration

Massachusetts Institute of Technology Quantum Mechanics I (8.04) Spring 2005 Solutions to Problem Set 6

Integral equations, eigenvalue, function interpolation

CBE 291b - Computation And Optimization For Engineers

Chapter 5 : Continuous Random Variables

and that at t = 0 the object is at position 5. Find the position of the object at t = 2.

Improper Integrals, and Differential Equations

Lecture 3 Gaussian Probability Distribution

MATH , Calculus 2, Fall 2018

7 - Continuous random variables

A REVIEW OF CALCULUS CONCEPTS FOR JDEP 384H. Thomas Shores Department of Mathematics University of Nebraska Spring 2007

Overview of Calculus I

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

Chapter 0. What is the Lebesgue integral about?

P 3 (x) = f(0) + f (0)x + f (0) 2. x 2 + f (0) . In the problem set, you are asked to show, in general, the n th order term is a n = f (n) (0)

Z b. f(x)dx. Yet in the above two cases we know what f(x) is. Sometimes, engineers want to calculate an area by computing I, but...

Pi evaluation. Monte Carlo integration

5.7 Improper Integrals

Lecture 19: Continuous Least Squares Approximation

f(x) dx, If one of these two conditions is not met, we call the integral improper. Our usual definition for the value for the definite integral

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

How can we approximate the area of a region in the plane? What is an interpretation of the area under the graph of a velocity function?

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

Lecture 20: Numerical Integration III

7.2 The Definite Integral

Problem Set 3 Solutions

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).

CHM Physical Chemistry I Chapter 1 - Supplementary Material

4.4 Areas, Integrals and Antiderivatives

221B Lecture Notes WKB Method

ARITHMETIC OPERATIONS. The real numbers have the following properties: a b c ab ac

Math 426: Probability Final Exam Practice

Lecture 1. Functional series. Pointwise and uniform convergence.

3.4 Numerical integration

8 Laplace s Method and Local Limit Theorems

Consequently, the temperature must be the same at each point in the cross section at x. Let:

JDEP 384H: Numerical Methods in Business

Operations with Polynomials

Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions

We partition C into n small arcs by forming a partition of [a, b] by picking s i as follows: a = s 0 < s 1 < < s n = b.

Classical Mechanics. From Molecular to Con/nuum Physics I WS 11/12 Emiliano Ippoli/ October, 2011

Reinforcement learning II

Name Solutions to Test 3 November 8, 2017

Abstract inner product spaces

Orthogonal Polynomials

Physics 741 Graduate Quantum Mechanics 1 Solutions to Final Exam, Fall 2011

13.4. Integration by Parts. Introduction. Prerequisites. Learning Outcomes

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

Numerical Integration

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17

Energy Bands Energy Bands and Band Gap. Phys463.nb Phenomenon

Physics 202H - Introductory Quantum Physics I Homework #08 - Solutions Fall 2004 Due 5:01 PM, Monday 2004/11/15

Numerical Analysis. 10th ed. R L Burden, J D Faires, and A M Burden

Lecture 1: Introduction to integration theory and bounded variation

Main topics for the First Midterm

Summary: Method of Separation of Variables

Math Calculus with Analytic Geometry II

Math 113 Exam 2 Practice

x = b a n x 2 e x dx. cdx = c(b a), where c is any constant. a b

Definition of Continuity: The function f(x) is continuous at x = a if f(a) exists and lim

Math 360: A primitive integral and elementary functions

Module 6: LINEAR TRANSFORMATIONS

INTRODUCTION TO INTEGRATION

Chapter 3 Solving Nonlinear Equations

Lesson 1: Quadratic Equations

Lecture 3. Limits of Functions and Continuity

Numerical Analysis: Trapezoidal and Simpson s Rule

Math 113 Fall Final Exam Review. 2. Applications of Integration Chapter 6 including sections and section 6.8

221A Lecture Notes WKB Method

Quantum Physics I (8.04) Spring 2016 Assignment 8

20 MATHEMATICS POLYNOMIALS

Math Lecture 23

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

We will see what is meant by standard form very shortly

The Wave Equation I. MA 436 Kurt Bryan

Section 6.1 Definite Integral

Transcription:

780.20 Session 3 (lst revised: Februry 25, 202) 3 3. 780.20 Session 3. Follow-ups to Session 2 Histogrms of Uniform Rndom Number Distributions. Here is typicl figure you might get when histogrmming uniform distributions using gnuplot (using plot... with steps to get the histogrm look): Two sets of numbers hve n verge of 2000 counts per Uniform Rndom Number Distributions 2000 500 # in bin 000 500 uniform uniform 2 uniform 3 uniform 4 0 0 0.2 0.4 0.6 0.8 Thu My 0 :38:2 2008 bin nd two sets hve n verge of 500 per bin. The size of the fluctutions should scle s # of counts in bin, which is evident in the figure. Tht is, the fluctutions of the top sets look roughly twice s lrge s those of the bottom set nd stndrd devition of 40 50 looks bout right. The Length of Rndom Wlks. In Session you explored how the finl distnce R from the origin of rndom wlk scles with the number of steps N. Remember tht there is no reltionship for ny individul wlk, but only sttisticl reltionship tht rises by verging R for given N over mny trils. Here is grph tht you might obtin: It shows good fit to the expected N dependence! x

780.20 Session 3 (lst revised: Februry 25, 202) 3 2 000 rndom wlks best-fit line sqrt(# of steps) Rndom Wlks fit slope = +0.54 finl distnce from origin 00 0 0 00 000 0000 00000 # of steps Thu My 0 0:22:20 2008 b. Recp of Session 2: Monte Crlo Integrtion nd Led-in to Session 3 We explored in Session 2 how we could pproximte n integrl f(x) dx by picking rndom sequence of N vlues of x, which we lbel {x i }, distributed uniformly on [, b]. Tht is, the probbility of choosing number between x nd x + dx is P uniform (x) dx = dx. (3.) b Note tht this PDF (probbility distribution function) is normlized, i.e., P uniform (x) dx = b s you d expect since the totl probbility must be unity. dx =, (3.2) The Monte Crlo expression for the integrl rises by pproximting the verge of f(x) in [, b]: We cn write this s f = b f(x) dx f(x i ). (3.3) N i f(x) P uniform (x) dx f(x i ). (3.4) N i

780.20 Session 3 (lst revised: Februry 25, 202) 3 3 You should hve found tht the ccurcy of the integrl improved sttisticlly with the number of points. Here is grph showing the results of 6 trils for ech vlue of N: Monte Crlo Integrtion monte crlo estimte best-fit line fit slope = -0.47 0. bsolute error 0.0 0.00 0 00 000 0000 00000 Thu My 0 0:2:09 2008 # of integrtion points The expected behvior is reveled by the fit (error improves like / N), but with lrge fluctutions. We should verge over mny more trils if we wnt clener demonstrtion! Now wht if we used different probbility distribution P (x)? Then if our N vlues of x, which we ll lbel { x i }, re distributed ccording to P (x), the verge of the f( x i ) s yields n pproximtion to the integrl over f(x)p (x): N f( x i ) i f(x) P (x) dx. (3.5) This mens tht we cn lwys divide given integrnd into prt tht we tret s probbility distribution (clled P (x) here) nd the rest (which is clled f(x) here). If we choose P (x) so tht f(x) vries only reltively slowly with x, we will get n ccurte estimte of the integrl. This is clled importnce smpling. The generliztion to mny dimensions is immedite: we simply replce one-dimensionl x by multi-dimensionl vector x everywhere. In Session 2 we sw tht GSL cn generte rndom numbers ccording to vrious one-dimensionl PDF s, such s uniform nd gussin distributions. But the multi-dimensionl integrls we ll wnt

780.20 Session 3 (lst revised: Februry 25, 202) 3 4 to do for physicl problems will generlly hve nonstndrd P (x). We will use the Metropolis lgorithm to generte n pproprite distribution of x i s. c. Thermodynmic Properties of the Ising Model If we wnt to clculte the thermodynmic properties of system t temperture T (tht is, in equilibrium) tht hs Hmiltonin H(x), we hve the problem of clculting high dimensionl integrl with rpidly vrying integrnd. Here H(x) is the energy of the system for given configurtion x. A configurtion is specifiction of the stte of the system in some relevnt vribles. For quntum mechnicl system of N spinless prticles, configurtion could be the N position vectors. For system of spins on lttice, configurtion could be specifiction of the spin projection t ech lttice point. We ll use the Ising model in one nd two dimensions s our first exmple. The system consists of set of lttice sites with spins, which tke on only two possible vlues, + or. The spins re rrnged in chin (one-dimensionl Ising model) or squre lttice (two-dimensionl Ising model). The interction between spins is short-rnged, which is represented in our model by interctions only between nerest neighbors. Tht is, there is potentil energy only from djcent spins. Ech spin hs two nerest neighbors in one dimension nd four nerest neighbors in two dimensions (digonls don t count here!). We hve to specify wht hppens t the edge of the system. E.g., do the ends of the onedimensionl chin hve only one nerest neighbor, or do we imgine the chin wrpped into continuous bnd? In the ltter cse, we hve periodic boundry conditions, becuse it is equivlent to imgining n infinite chin tht repets itself periodiclly. We lso llow for n externl constnt mgnetic field, H, which intercts with ech of the spins individully to contribute Zeemn energy. (Note: the nottion H for the mgnetic field is somewht unfortunte becuse of the confusion with the Hmiltonin. In other references such s Lndu nd Pez, H µb is used insted.) We choose units so tht the Hmiltonin tkes the simple form: H(x) = J i,j S i S j i HS i, (3.6) where S i = ± is the spin. Here x is just shorthnd for specifiction of the spin S i on ech site. For one-dimensionl Ising model with N sites, you could store this s n rry of length N with ech element either + or.

780.20 Session 3 (lst revised: Februry 25, 202) 3 5 The nottion i, j stnds for nerest neighbor pirs of spins. Obviously the product S i S j cn be either + or. In mny pplictions we ll set the externl field H to zero. The constnt J (clled the exchnge energy ) specifies the strength of the spin-spin interction. For ferromgnetic interction, J > 0, while for n nti-feromgnetic interction J < 0. Wht do you think is the physicl origin of J for ferromgnetic interction? The mgnetiztion of the system is the verge vlue of the spin, S i, where the verge is tken over the entire lttice. If the spins re eqully likely to be up (+) s down ( ), then the net mgnetiztion is zero. In n externl mgnetic field, up or down will be fvored energeticlly (if H > 0 in H(x) bove, which is fvored?), nd there will generlly be net mgnetiztion. In ferromgnet t sufficiently low temperture, there will be spontneous mgnetiztion even in the bsence of n externl field. This my occur over regions ( domins ) or over the entire lttice. A configurtion in the Ising model is microstte of the system. If we hve N sites in onedimensionl Ising model, how mny possible configurtions (or microsttes) re there? How mny different vlues of the energy (with H = 0)? The therml verge of quntity A tht depends on the configurtion x (exmples of A re the energy per degree of freedom E = H T /N or the mgnetiztion per degree of freedom M = i S i T /N) is given by the cnonicl ensemble (the denomintor is the prtition function Z) dx A(x) e H(x)/kT A(x) T = dx = dx A(x) P e H(x )/kt eq (H(x)), (3.7) where we hve pulled out the Boltzmnn fctors to identify the probbility distribution function P eq (H(x)): e H(x)/kT P eq (H(x)) = dx e H(x )/kt. (3.8) (Is this PDF normlized?) In the Ising model exmple, the integrtion over x is just sum over the spin configurtions. If our configurtions re chosen s eigensttes of energy (which they re in the Ising model exmple), then we cn just sum over energies rther thn every configurtion: A T = (# of sttes with energy E) A(E) e E/kT E E (# of sttes with energy E ) e E /kt = E A(E) P (E). (3.9) If we cn construct set of N configurtions { x i } ( sttisticl smple) tht re distributed ccording to P, then we cn pply our Monte Crlo method (i.e., we will be doing importnce smpling) nd A T = (/N) i A( x i). This is wht the Metropolis lgorithm does for us!

780.20 Session 3 (lst revised: Februry 25, 202) 3 6 d. Metropolis Algorithm The first thing to get stright is tht the Metropolis lgorithm hs nothing to do with Supermn or Fritz Lng :). It is nmed for the first uthor on the pper tht described the lgorithm. (A bit of trivi: nother uthor on the pper is Edwrd Teller.) The Metropolis lgorithm genertes Mrkov chin; this is sequence of configurtions x i tht will be distributed ccording to the cnonicl distribution (i.e., the Boltzmnn fctor will tell us the reltive probbility of ny configurtion). The Mrkov process constructs stte x l+ from the previous stte x l ccording to trnsition probbility W (x l x l+ ). The ide is to construct W such tht in the limit of lrge number of configurtions, the distribution of sttes x i pproches the equilibrium Boltzmn distribution P eq from Eq. (3.8). A sufficient condition for this to hppen is tht the principle of detiled blnce should hold. In equilibrium, the rte of x x should equl the rte of x x, or else it is not equilibrium! In clculting these rtes, there re two terms to multiply: ( ) ( ) probbility probbility of x x (# of x s) = of x x (# of x s) (3.0) time time or which is detiled blnce. This mens tht W (x x ) N P eq (x) = W (x x) N P eq (x ), (3.) W (x x ) W (x x) = P eq(x) P eq (x ). (3.2) But we know tht P eq (x) = Z e H(x)/kT. (3.3) Any choice of W stisfying Eq. (3.2) should work, in principle. For exmple, we cn tke W (x x ) = { e δe/kt if δe > 0 if δe 0 (3.4) with rbitrry for now (set it equl to unity for convenience) nd where δe E x E x. (3.5) We cn check tht it works by considering ll possible outcomes, s shown in this chrt: δe W (x x ) e E/kT δe W (x x) e E/kT E x > E x > 0 e (E x Ex)/kT e Ex/kT < 0 E x < E x < 0 e Ex/kT > 0 e (Ex E x )/kt e E x /kt e E x /kt

780.20 Session 3 (lst revised: Februry 25, 202) 3 7 If you do the multiplictions, you ll see tht detiled blnce is stisfied in every cse. Section 2.2 of the Binder/Heermn excerpt describes n implementtion of Metropolis for the Ising model. The bsic ide is tht from strting configurtion, one genertes cndidte for new configurtion somehow (for exmple, by flipping one rndomly selected spin). After clculting the energy chnge between new nd old, one hs the trnsition probbility W from Eq. (3.4). Generte rndom number between 0 nd ; if the number is less thn W keep the new configurtion but otherwise flip the spin bck nd keep this s the new configurtion. We ll go over vrious implementtion issues in this Session nd the next. These include: Equilibrtion. If we re going to use configurtions generted by Metropolis to clculte therml verges, we wnt to mke sure we hve reched equilibrium. How long does this tke nd wht is the signture? Efficiency. The initil two-dimensionl Ising model code hs severl inefficiencies tht re generic to mny types of Monte Crlo simultions. In Session 4 we ll look t how to optimize to gin fctor of six in speed. Autocorreltion. When evluting n verge over Monte Crlo configurtions, we wnt to skip the first n steps nd then use dt tken every n 0 Monte Crlo steps. How do we determine how lrge to tke n 0 nd n? The utocorreltion function cn be used to determine resonble choice for n 0. e. References [] R.H. Lndu nd M.J. Pez, Computtionl Physics: Problem Solving with Computers (Wiley- Interscience, 997). [See the 780.20 info webpge for detils on new version.] [2] M. Hjorth-Jensen, Lecture Notes on Computtionl Physics (2009). These re notes from course offered t the University of Oslo. See the 780.20 webpge for links to excerpts. [3] W. Press et l., Numericl Recipes in C++, 3rd ed. (Cmbridge, 2007). Chpters from the 2nd edition re vilble online from http://www.nrbook.com//. There re lso Fortrn versions.