n t n copyright oxford university press 2006 v2.0

2
9/13/21 1 Lecture 7 PHYS 416 Tuesday Sep 14 Fall 2021 1. Return Quiz 1 2. Zombie HW solution 3. Comment on separation of variables 4. Example: 1D diffusion, Fourier solution 5. Solving the diffusion equation – Green 6. Worksheet: Problem 2.6 Fourier and Green 1 (6.21) Epidemics and zombies. 7 (a) What is the equation for ˙ I implied by these first two equations, assuming no infected people die or shift groups other than by new infections or recoveries? We shall use a less common, but even simpler (b) Argue that the only stationary states have all zombies or all humans. Both ˙ S and ˙ Z are linear in SZ, so there must be a linear combination of the two that has no time dependence. Show that P = Z + (1 -κ/β)S satisfies ˙ P =0. Argue from these two facts that for P< 0 the zombies must lose. (c) Show that χ = S/Z satisfies ˙ χ = γχ, and (c) Show that χ = S/Z satisfies ˙ χ = γχ, and so χ(t)= χ0 exp(γt). Show that γ = -βP. 75 (d) Write the probability density of the first event, ρtot(t), in terms of ρ1, ρ2, S1, and S2. (The final answer should involve no integrals or derivatives.) Specialize to systems with constant rates, which have an exponentially decaying sur- vival time, Sn(t) = exp(-γnt). Show that the total event rate γtot is the sum γ1 + γ2. Show that the probability of the next event being of type #1 is γ1/γtot. To simulate one step of our discrete SZR model, 2 (e) Write a routine to use the Gillespie algorithm to solve the discrete SZR model for eqns 6.96, keeping track of t, S, Z, and R for each event, ending when S =0 or Z =0, and adding an ex- tra point at tmax if the system terminates early. Write a routine numerically solve the continuum equations 6.95. Use β =0.001, κ =0.0008, and tmax =5. (Should the zombies win?) Plot the two for initial conditions Z0 = 100, S0 = 9900, and R0 =0 (a simultaneous outbreak of a hun- dred zombies). Is the continuum limit faithfully describing the behavior for large numbers of zom- bies and humans? Now let us examine the likelihood of zombies be- 3 (f) Plot the continuum solution with the zom- bie simulation for twenty initial conditions using Z0 =1, S0 = 9999, and R0 =0. Are the simula- tions suering from more fluctuations than they did for larger number of zombies? Do you see evidence for zombie extinction early in the out- break? What fraction of the initial outbreaks ap- pear to have killed oall the humans? Zoom in and plot at early times (Z 5, t< 0.5) and note a few trajectories where the first zombie is killed before biting, and trajectories where the zombie population goes extinct after reaching a peak pop- ulation of two or three. 4 (g) Was the fraction of extinctions you ob- served in part (f) roughly given by the calcula- tion above? Write a simpler routine that sim- ulates the Gillespie algorithm over n epidemics, reporting the fraction in which zombies go ex- tinct (observing only whether Z =0 happens be- fore S =0, ignoring the time and the trajectory). For S0 = 9999 and 1000 epidemics, how good is the prediction? Draw a plot of Pext versus log S0, for S0 =1, 2, 4, . . . , 512, using 1000 epidemics each. How large must the human population be before our estimate P ext is within about 10% of the correct answer? 5 (2.6) Fourier and Green. 2 An initial density profile ρ(x, t = 0) is per- turbed slightly away from a uniform density ρ0, as shown in Fig. 2.11. The density obeys the diusion equation ∂ρ/t = D2 ρ/x 2 , where D =0.001 m 2 /s. The lump centered at x0 =5 is a Gaussian exp(-(x -x0) 2 /2)/ 2π, and the wiggle centered at x = 15 is a smooth envelope function multiplying cos(10x). (a) Fourier. As a first step in guessing how the pictured density will evolve, let us consider just a cosine wave. If the initial wave were ρcos(x, 0) = cos(10x), what would it be at t = 10s? Related formulæ: ρ(k, t)= ρ(k, t ) G(k, t -t ); G(k, t)= exp(-Dk 2 t). (b) Green. As a second step, let us check how long an initial δ-function would take to spread out as far as the Gaussian on the left. If the wave at some earlier time -t0 were a δ- function at x =0, ρ(x, -t0)=δ(x), what choice of the time elapsed t0 would yield a Gaussian ρ(x, 0) = exp(-x 2 /2)/ 2π for the given dif- fusion constant D = 0.001 m 2 /s? Related formulæ: ρ(x, t)= ρ(y,t )G(y - x, t - t )dy; G(x, t) = (1/ 4πDt) exp(-x 2 /(4Dt)). 0 5 10 15 20 Position x -0.4 0 0.4 ρ(x, t = 0) - ρ 0 Fig. 2.11 Initial profile of density deviation from average. (c) Pictures. Now consider time evolution for the next ten seconds. The initial density pro- file ρ(x, t = 0) is as shown in Fig. 2.11. Which of the choices (A)–(E) represents the density at t = 10 s? (Hint: Compare t = 10 s to the time t0 from part (b).) Related formulæ: x 2 2Dt. (A) 10 15 20 25 30 Position x -0.4 0 0.4 ρ(x, t = 10) - ρ 0 (B) 0 5 10 15 20 Position x -0.4 0 0.4 ρ(x, t = 10) - ρ 0 (C) 0 5 10 15 20 Position x -0.4 0 0.4 ρ(x, t = 10) - ρ 0 (D) 0 5 10 15 20 Position x -0.4 0 0.4 ρ(x, t = 10) - ρ 0 (E) 0 5 10 15 20 Position x -0.4 0 0.4 ρ(x, t = 10) - ρ 0 6

Upload: others

Post on 19-Dec-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: n t n Copyright Oxford University Press 2006 v2.0

9/13/21

1

Lecture 7 PHYS 416 Tuesday Sep 14 Fall 2021

1. Return Quiz 12. Zombie HW solution3. Comment on separation of variables4. Example: 1D diffusion, Fourier solution5. Solving the diffusion equation – Green6. Worksheet: Problem 2.6 Fourier and Green

1

Copyright Oxford University Press 2006 v2.0 --

Exercises 173

to find the extremum of

L = kS∑

j

Nj log(N/Nj)

− β(∑

j

NjCj − E)

− λ(∑

j

Nj/N − 1)

(6.94)

with respect to Nj , N , β, and λ. RememberkS = 1/ log(2).(b) Give the equations found by varying L withrespect to N . Solve for λ.(c) Give the equations found by varying L withrespect to Nj . Using your result form part (b),solve for Nj in terms of β, Cj, and N .(d) Using the three-letter language effort CAbc

j

above, use your result from part (c) to solve forβ. (Hint: Make N = N1 +N2 +N3.) Do the re-sulting optimal letter frequencies agree with thosegiven above? Using the effort Cword

j = log2 j,give the power law governing the word distribu-tion, in terms of β, N , and λ. If the word dis-tribution is presumed to continue to j → ∞, atwhat value of β does it become impossible to keepthe distribution normalized? How does this ex-treme value compare with Zipf ’s law?You might ask what value for β we find for ourlogarithmic compression Cword, by using the nor-malization (as you did for CAbc in part (d)).Note that the unmodified use of Cword

j = log2(j)does not make sense, since the most commonword with j = 1 costs no effort (log2(1) = 0). Inour brain-compressed series of words, one mustimagine some marker corresponding to the ex-tra space we use between each word. Supposewe model the extra marker as a third option fora ’letter’, so each symbol being transmitted hasthree ‘character states’ (0, 1, ‘ ’) rather thantwo. If we add one extra space marker separat-ing every word, so Cj = Cword +1 = 1+ log2(j),simulations with 100 total words give β ∼ 1.4 –cutting off the probability of rare words prettydrastically. (Oddly, if one adds two extra spacecharacters between words, one gets pretty closeto Zipf’s law and optimal compression.)Now we turn to the information I , the effort E,and the analytical calculation of β. We arguedin Exercises 5.15 that a communication channel

reliably transmitting bits can transmit no morethan one unit of Shannon information entropyper bit. In this exercise, we are optimizing theinformation transfer over the frequencies Nj fora given language with words of cost Cj . A poorchoice for the Cj will not saturate the Shannonbound.(e) What does this general bound for any lan-guage imply about the ratio I/E, for effort mea-sured in two-state characters? If we include anextra marker as an allowed ‘character state’ inthe channel, what would the maximum Shannonentropy be per character? (Now I is measuredin two-state letters, and E is measured in three-state characters.) What bound do we thus derivefor I/E if spaces are allowed?Instead of determining β from the normalization,we can take derivatives of L to find it analyti-cally. It turns out to be related to the informa-tion I and the effort E (eqns 6.92 and 6.93).(f) Give the equation found by varying L withrespect to β. Using your results from part (c),solve for the effort E in terms of β, the numberof words N and the Ci. Is the number of wordslinear in the effort budget?(g) Solve for the information I. Solve for theinformation per unit effort I/E, in terms of β.How close does our three-word language CAbc

(which needs no spaces between words) approachShannon’s fundamental bound? How close doesmy computation for β using Cword + 1 approachthe bound for three allowed characters?It is not clear from this analysis why natural lan-guages form an extremal limit of optimal infor-mation transmission. After all, CAbc, or even atwo-word language of 0’s and 1’s, can be used tooptimize the Shannon information transmissionper symbol. Perhaps we need a large vocabu-lary to support an advanced civilization.73 Inthat case, given the logarithmic nature of com-pression algorithms (and a perhaps unlikely as-sumption that our brain uses word compressionto process language), Zipf’s law arguably arisesas the distribution which optimizes communica-tion per unit effort while also maximizing thevocabulary size.

(6.21) Epidemics and zombies.74 (Biology, Epi-

73Perhaps a large vocabulary enhances reproductive success? Communicating with patterns of two types of grunts might notcompete in the social arena, no matter how efficient.74Hints for the computations can be found at the book Web site [167].

Copyright Oxford University Press 2006 v2.0 --

174 Free energies

demiology) ©3This exercise is based on Alemi and Bierbaum’sclass project, published in You can run, you canhide: The epidemiology and statistical mechanicsof zombies [2]. See also the Zombietown site [26]and simulator [27].Epidemics are studied by disease control spe-cialists using statistical methods, modeling thepropagation of the disease as susceptible peo-ple are infected, infect others, and recover (e.g.,to study measles outbreaks as anti-vaccine senti-ments change with time [134]). The SIR modelis the simplest commonly studied model, withthree coupled differential equations: S = −βSIreflects the rate β at which each infected personI infects each susceptible person S, and R = κIreflects the rate κ that each infected person joinsthe recovered population R.(a) What is the equation for I implied by thesefirst two equations, assuming no infected peopledie or shift groups other than by new infectionsor recoveries?We shall use a less common, but even simplerSZR model [2], designed to predict the evolutionof a zombie outbreak.

S = −βSZZ = (β − κ)SZ (6.95)

R = κSZ.

Here the zombie population Z never recovers,but if it is destroyed by a member of the surviv-ing population S, it joins the removed popula-tion R. The bite parameter β describes the rateat which a zombie bites a human it encounters,and the kill parameter κ gives the rate that ahuman may destroy a zombie it finds.The SZR model is even simpler than the SIRmodel, in that one can write an explicit solutionfor the evolution as a function of time. We do soin two steps.(b) Argue that the only stationary states have allzombies or all humans. Both S and Z are linearin SZ, so there must be a linear combination ofthe two that has no time dependence. Show thatP = Z+(1−κ/β)S satisfies P = 0. Argue fromthese two facts that for P < 0 the zombies mustlose.(c) Show that χ = S/Z satisfies χ = γχ, andso χ(t) = χ0 exp(γt). Show that γ = −βP .75

Check that this answer concurs with your crite-rion for human survival in part (b).So the fraction of the doomed species exponen-tially decays, and the population of the survivingspecies is determined by P . If desired, one coulduse the added equation S(t) + Z(t) + R(t) = Nwith your answers to parts (b) and (c) to solveanalytically for the explicit time evolution of S,Z, and R. We shall solve these equations numer-ically instead (below).Suppose now that we start with a single zombieZ0 = 1, and the number of humans S0 is large.It would seem from our equation for our invari-ant P from part (b) that if the bite parameterβ is greater than the kill parameter κ that thehumans are doomed. But surely there is somechance that we will be lucky, and kill the zombiebefore it bites any of us? This will happen withprobability κ/(β + κ). If we fail the first time,we can hope to destroy two zombies before eitherbites again. . .Here is where the statistical fluctuations becomeimportant. The differential eqns 6.95 are a con-tinuum approximation to the discrete transitionsbetween integer numbers of the three species.These three equations are similar to reactionrate equations in chemistry (as in eqn 6.50) withmolecules replaced by people:

S + ZβSZ−−−→ 2Z

S + ZκSZ−−−→ S +R.

(6.96)

Just as for disease outbreaks, if the number ofmolecules is small then chemical reactions ex-hibit important statistical fluctuations. Thesefluctuations are important, for example, for thebiology inside cells, where the numbers of a givenspecies of RNA or protein can be small, and thenumber of DNA sites engaging in creating RNAis usually either zero or one (see Exercises 8.10and 8.11).We can simulate each individual bite and killevent for a population of S humans and Z zom-bies. (Indeed, this can be done rather effi-ciently for the entire population of the USA;see [2, 26, 27].) The time to the next event isan exponential random variable given by the to-tal event rate. Which event happens next is thenweighted by the individual rates for the differentevents.It is well known that decay rates add. Let us

75Note that some of the solutions in reference [2] have typographical errors.

Copyright Oxford University Press 2006 v2.0 --

174 Free energies

demiology) ©3This exercise is based on Alemi and Bierbaum’sclass project, published in You can run, you canhide: The epidemiology and statistical mechanicsof zombies [2]. See also the Zombietown site [26]and simulator [27].Epidemics are studied by disease control spe-cialists using statistical methods, modeling thepropagation of the disease as susceptible peo-ple are infected, infect others, and recover (e.g.,to study measles outbreaks as anti-vaccine senti-ments change with time [134]). The SIR modelis the simplest commonly studied model, withthree coupled differential equations: S = −βSIreflects the rate β at which each infected personI infects each susceptible person S, and R = κIreflects the rate κ that each infected person joinsthe recovered population R.(a) What is the equation for I implied by thesefirst two equations, assuming no infected peopledie or shift groups other than by new infectionsor recoveries?We shall use a less common, but even simplerSZR model [2], designed to predict the evolutionof a zombie outbreak.

S = −βSZZ = (β − κ)SZ (6.95)

R = κSZ.

Here the zombie population Z never recovers,but if it is destroyed by a member of the surviv-ing population S, it joins the removed popula-tion R. The bite parameter β describes the rateat which a zombie bites a human it encounters,and the kill parameter κ gives the rate that ahuman may destroy a zombie it finds.The SZR model is even simpler than the SIRmodel, in that one can write an explicit solutionfor the evolution as a function of time. We do soin two steps.(b) Argue that the only stationary states have allzombies or all humans. Both S and Z are linearin SZ, so there must be a linear combination ofthe two that has no time dependence. Show thatP = Z+(1−κ/β)S satisfies P = 0. Argue fromthese two facts that for P < 0 the zombies mustlose.(c) Show that χ = S/Z satisfies χ = γχ, andso χ(t) = χ0 exp(γt). Show that γ = −βP .75

Check that this answer concurs with your crite-rion for human survival in part (b).So the fraction of the doomed species exponen-tially decays, and the population of the survivingspecies is determined by P . If desired, one coulduse the added equation S(t) + Z(t) + R(t) = Nwith your answers to parts (b) and (c) to solveanalytically for the explicit time evolution of S,Z, and R. We shall solve these equations numer-ically instead (below).Suppose now that we start with a single zombieZ0 = 1, and the number of humans S0 is large.It would seem from our equation for our invari-ant P from part (b) that if the bite parameterβ is greater than the kill parameter κ that thehumans are doomed. But surely there is somechance that we will be lucky, and kill the zombiebefore it bites any of us? This will happen withprobability κ/(β + κ). If we fail the first time,we can hope to destroy two zombies before eitherbites again. . .Here is where the statistical fluctuations becomeimportant. The differential eqns 6.95 are a con-tinuum approximation to the discrete transitionsbetween integer numbers of the three species.These three equations are similar to reactionrate equations in chemistry (as in eqn 6.50) withmolecules replaced by people:

S + ZβSZ−−−→ 2Z

S + ZκSZ−−−→ S +R.

(6.96)

Just as for disease outbreaks, if the number ofmolecules is small then chemical reactions ex-hibit important statistical fluctuations. Thesefluctuations are important, for example, for thebiology inside cells, where the numbers of a givenspecies of RNA or protein can be small, and thenumber of DNA sites engaging in creating RNAis usually either zero or one (see Exercises 8.10and 8.11).We can simulate each individual bite and killevent for a population of S humans and Z zom-bies. (Indeed, this can be done rather effi-ciently for the entire population of the USA;see [2, 26, 27].) The time to the next event isan exponential random variable given by the to-tal event rate. Which event happens next is thenweighted by the individual rates for the differentevents.It is well known that decay rates add. Let us

75Note that some of the solutions in reference [2] have typographical errors.

Copyright Oxford University Press 2006 v2.0 --

174 Free energies

demiology) ©3This exercise is based on Alemi and Bierbaum’sclass project, published in You can run, you canhide: The epidemiology and statistical mechanicsof zombies [2]. See also the Zombietown site [26]and simulator [27].Epidemics are studied by disease control spe-cialists using statistical methods, modeling thepropagation of the disease as susceptible peo-ple are infected, infect others, and recover (e.g.,to study measles outbreaks as anti-vaccine senti-ments change with time [134]). The SIR modelis the simplest commonly studied model, withthree coupled differential equations: S = −βSIreflects the rate β at which each infected personI infects each susceptible person S, and R = κIreflects the rate κ that each infected person joinsthe recovered population R.(a) What is the equation for I implied by thesefirst two equations, assuming no infected peopledie or shift groups other than by new infectionsor recoveries?We shall use a less common, but even simplerSZR model [2], designed to predict the evolutionof a zombie outbreak.

S = −βSZZ = (β − κ)SZ (6.95)

R = κSZ.

Here the zombie population Z never recovers,but if it is destroyed by a member of the surviv-ing population S, it joins the removed popula-tion R. The bite parameter β describes the rateat which a zombie bites a human it encounters,and the kill parameter κ gives the rate that ahuman may destroy a zombie it finds.The SZR model is even simpler than the SIRmodel, in that one can write an explicit solutionfor the evolution as a function of time. We do soin two steps.(b) Argue that the only stationary states have allzombies or all humans. Both S and Z are linearin SZ, so there must be a linear combination ofthe two that has no time dependence. Show thatP = Z+(1−κ/β)S satisfies P = 0. Argue fromthese two facts that for P < 0 the zombies mustlose.(c) Show that χ = S/Z satisfies χ = γχ, andso χ(t) = χ0 exp(γt). Show that γ = −βP .75

Check that this answer concurs with your crite-rion for human survival in part (b).So the fraction of the doomed species exponen-tially decays, and the population of the survivingspecies is determined by P . If desired, one coulduse the added equation S(t) + Z(t) + R(t) = Nwith your answers to parts (b) and (c) to solveanalytically for the explicit time evolution of S,Z, and R. We shall solve these equations numer-ically instead (below).Suppose now that we start with a single zombieZ0 = 1, and the number of humans S0 is large.It would seem from our equation for our invari-ant P from part (b) that if the bite parameterβ is greater than the kill parameter κ that thehumans are doomed. But surely there is somechance that we will be lucky, and kill the zombiebefore it bites any of us? This will happen withprobability κ/(β + κ). If we fail the first time,we can hope to destroy two zombies before eitherbites again. . .Here is where the statistical fluctuations becomeimportant. The differential eqns 6.95 are a con-tinuum approximation to the discrete transitionsbetween integer numbers of the three species.These three equations are similar to reactionrate equations in chemistry (as in eqn 6.50) withmolecules replaced by people:

S + ZβSZ−−−→ 2Z

S + ZκSZ−−−→ S +R.

(6.96)

Just as for disease outbreaks, if the number ofmolecules is small then chemical reactions ex-hibit important statistical fluctuations. Thesefluctuations are important, for example, for thebiology inside cells, where the numbers of a givenspecies of RNA or protein can be small, and thenumber of DNA sites engaging in creating RNAis usually either zero or one (see Exercises 8.10and 8.11).We can simulate each individual bite and killevent for a population of S humans and Z zom-bies. (Indeed, this can be done rather effi-ciently for the entire population of the USA;see [2, 26, 27].) The time to the next event isan exponential random variable given by the to-tal event rate. Which event happens next is thenweighted by the individual rates for the differentevents.It is well known that decay rates add. Let us

75Note that some of the solutions in reference [2] have typographical errors.

Copyright Oxford University Press 2006 v2.0 --

Exercises 175

nonetheless derive this. Let the probability den-sity of event type #n be ρn(t), with survivalprobability Sn(t) = 1 −

∫ t

0ρn(τ )dτ . Let there

be two types of events.(d) Write the probability density of the firstevent, ρtot(t), in terms of ρ1, ρ2, S1, and S2.(The final answer should involve no integrals orderivatives.) Specialize to systems with constantrates, which have an exponentially decaying sur-vival time, Sn(t) = exp(−γnt). Show that thetotal event rate γtot is the sum γ1 + γ2. Showthat the probability of the next event being of type#1 is γ1/γtot.To simulate one step of our discrete SZR model,we

(i) find the total rate of events γtot,

(ii) increment t by ∆t, a random numberpulled from an exponential distributionwith decay rate γtot,

(iii) choose to bite or to kill by choosing arandom number uniform in (0, γtot), andchecking if it is less than γ1,

(iv) change S, Z, and R appropriately for theevent, and

(v) perform any observations needed.

This is a simple example of the Gillespie algo-rithm, discussed in more detail in Exercises 8.10and 8.11.(e) Write a routine to use the Gillespie algorithmto solve the discrete SZR model for eqns 6.96,keeping track of t, S, Z, and R for each event,ending when S = 0 or Z = 0, and adding an ex-tra point at tmax if the system terminates early.Write a routine numerically solve the continuumequations 6.95. Use β = 0.001, κ = 0.0008, andtmax = 5. (Should the zombies win?) Plot thetwo for initial conditions Z0 = 100, S0 = 9900,and R0 = 0 (a simultaneous outbreak of a hun-dred zombies). Is the continuum limit faithfullydescribing the behavior for large numbers of zom-bies and humans?Now let us examine the likelihood of zombies be-ing stamped out despite their advantage in bit-ing, if we start with only one zombie.(f) Plot the continuum solution with the zom-bie simulation for twenty initial conditions usingZ0 = 1, S0 = 9999, and R0 = 0. Are the simula-tions suffering from more fluctuations than theydid for larger number of zombies? Do you see

evidence for zombie extinction early in the out-break? What fraction of the initial outbreaks ap-pear to have killed off all the humans? Zoom inand plot at early times (Z ≤ 5, t < 0.5) and notea few trajectories where the first zombie is killedbefore biting, and trajectories where the zombiepopulation goes extinct after reaching a peak pop-ulation of two or three.We can estimate the probability P∞ext that a sin-gle zombie with bite rate larger than kill ratewill go extinct before taking over a large initialhuman population S0 →∞. As described in ref-erence [2], the probability Pext that the zombiesgo extinct, in the limit of many humans, is equalto the probability that the first one is destroyed,plus the probability that it bites first times theprobability that both zombie lines go extinct:

P∞ext =κ

β + κ+

ββ + κ

(P∞ext)2. (6.97)

This can be solved to show P∞ext = κ/β.Exactly this same argument holds for regular dis-ease outbreaks. Similar arguments can be usedto determine the likelihood that an advantageousgene mutation will take over a large population.(g) Was the fraction of extinctions you ob-served in part (f) roughly given by the calcula-tion above? Write a simpler routine that sim-ulates the Gillespie algorithm over n epidemics,reporting the fraction in which zombies go ex-tinct (observing only whether Z = 0 happens be-fore S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good isthe prediction? Draw a plot of Pext versus log S0,for S0 = 1, 2, 4, . . . , 512, using 1000 epidemicseach. How large must the human population bebefore our estimate P∞ext is within about 10% ofthe correct answer?

(6.22) Nucleosynthesis as a chemical reaction.76

(Astrophysics) ©3The very early Universe was so hot that anyheavier nuclei quickly evaporated into protonsand neutrons. Between a few seconds and a cou-ple of minutes after the Big Bang, protons andneutrons began to fuse into light nuclei – mostlyhelium. The energy barriers for conversion toheavier elements were too slow, however, by thetime they became entropically favorable. Almostall of the heavier elements on Earth were formedlater, inside stars.

76This exercise was developed in collaboration with Katherine Quinn.

2

Copyright Oxford University Press 2006 v2.0 --

Exercises 175

nonetheless derive this. Let the probability den-sity of event type #n be ρn(t), with survivalprobability Sn(t) = 1 −

∫ t

0ρn(τ )dτ . Let there

be two types of events.(d) Write the probability density of the firstevent, ρtot(t), in terms of ρ1, ρ2, S1, and S2.(The final answer should involve no integrals orderivatives.) Specialize to systems with constantrates, which have an exponentially decaying sur-vival time, Sn(t) = exp(−γnt). Show that thetotal event rate γtot is the sum γ1 + γ2. Showthat the probability of the next event being of type#1 is γ1/γtot.To simulate one step of our discrete SZR model,we

(i) find the total rate of events γtot,

(ii) increment t by ∆t, a random numberpulled from an exponential distributionwith decay rate γtot,

(iii) choose to bite or to kill by choosing arandom number uniform in (0, γtot), andchecking if it is less than γ1,

(iv) change S, Z, and R appropriately for theevent, and

(v) perform any observations needed.

This is a simple example of the Gillespie algo-rithm, discussed in more detail in Exercises 8.10and 8.11.(e) Write a routine to use the Gillespie algorithmto solve the discrete SZR model for eqns 6.96,keeping track of t, S, Z, and R for each event,ending when S = 0 or Z = 0, and adding an ex-tra point at tmax if the system terminates early.Write a routine numerically solve the continuumequations 6.95. Use β = 0.001, κ = 0.0008, andtmax = 5. (Should the zombies win?) Plot thetwo for initial conditions Z0 = 100, S0 = 9900,and R0 = 0 (a simultaneous outbreak of a hun-dred zombies). Is the continuum limit faithfullydescribing the behavior for large numbers of zom-bies and humans?Now let us examine the likelihood of zombies be-ing stamped out despite their advantage in bit-ing, if we start with only one zombie.(f) Plot the continuum solution with the zom-bie simulation for twenty initial conditions usingZ0 = 1, S0 = 9999, and R0 = 0. Are the simula-tions suffering from more fluctuations than theydid for larger number of zombies? Do you see

evidence for zombie extinction early in the out-break? What fraction of the initial outbreaks ap-pear to have killed off all the humans? Zoom inand plot at early times (Z ≤ 5, t < 0.5) and notea few trajectories where the first zombie is killedbefore biting, and trajectories where the zombiepopulation goes extinct after reaching a peak pop-ulation of two or three.We can estimate the probability P∞ext that a sin-gle zombie with bite rate larger than kill ratewill go extinct before taking over a large initialhuman population S0 →∞. As described in ref-erence [2], the probability Pext that the zombiesgo extinct, in the limit of many humans, is equalto the probability that the first one is destroyed,plus the probability that it bites first times theprobability that both zombie lines go extinct:

P∞ext =κ

β + κ+

ββ + κ

(P∞ext)2. (6.97)

This can be solved to show P∞ext = κ/β.Exactly this same argument holds for regular dis-ease outbreaks. Similar arguments can be usedto determine the likelihood that an advantageousgene mutation will take over a large population.(g) Was the fraction of extinctions you ob-served in part (f) roughly given by the calcula-tion above? Write a simpler routine that sim-ulates the Gillespie algorithm over n epidemics,reporting the fraction in which zombies go ex-tinct (observing only whether Z = 0 happens be-fore S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good isthe prediction? Draw a plot of Pext versus log S0,for S0 = 1, 2, 4, . . . , 512, using 1000 epidemicseach. How large must the human population bebefore our estimate P∞ext is within about 10% ofthe correct answer?

(6.22) Nucleosynthesis as a chemical reaction.76

(Astrophysics) ©3The very early Universe was so hot that anyheavier nuclei quickly evaporated into protonsand neutrons. Between a few seconds and a cou-ple of minutes after the Big Bang, protons andneutrons began to fuse into light nuclei – mostlyhelium. The energy barriers for conversion toheavier elements were too slow, however, by thetime they became entropically favorable. Almostall of the heavier elements on Earth were formedlater, inside stars.

76This exercise was developed in collaboration with Katherine Quinn.

Exercises 189

Answer Fig. 1 Discrete vs. continuum solutions of SZR equations.

Now let us examine the likelihood of zombies being stamped out despite their advantage in biting, if westart with only one zombie.(f) Plot the continuum solution with the zombie simulation for twenty initial conditions using Z0 = 1,S0 = 9999, and R0 = 0. Are the simulations su↵ering from more fluctuations than they did for largernumber of zombies? Do you see evidence for zombie extinction early in the outbreak? What fraction of theinitial outbreaks appear to have killed o↵ all the humans? Zoom in and plot at early times (Z 5, t < 0.5)and note a few trajectories where the first zombie is killed before biting, and trajectories where the zombiepopulation goes extinct after reaching a peak population of two or three.

Answer Fig. 2 Do the zombies get stamped out?. Four of the trajectories have the zombies win, in this simulationof twenty trajectories. It appears as if the humans have hope.

The simulations are fluctuating significantly more. Specifically, the majority appear to have stomped outthe zombies before the outbreak got going (below).

3

Copyright Oxford University Press 2006 v2.0 --

Exercises 175

nonetheless derive this. Let the probability den-sity of event type #n be ρn(t), with survivalprobability Sn(t) = 1 −

∫ t

0ρn(τ )dτ . Let there

be two types of events.(d) Write the probability density of the firstevent, ρtot(t), in terms of ρ1, ρ2, S1, and S2.(The final answer should involve no integrals orderivatives.) Specialize to systems with constantrates, which have an exponentially decaying sur-vival time, Sn(t) = exp(−γnt). Show that thetotal event rate γtot is the sum γ1 + γ2. Showthat the probability of the next event being of type#1 is γ1/γtot.To simulate one step of our discrete SZR model,we

(i) find the total rate of events γtot,

(ii) increment t by ∆t, a random numberpulled from an exponential distributionwith decay rate γtot,

(iii) choose to bite or to kill by choosing arandom number uniform in (0, γtot), andchecking if it is less than γ1,

(iv) change S, Z, and R appropriately for theevent, and

(v) perform any observations needed.

This is a simple example of the Gillespie algo-rithm, discussed in more detail in Exercises 8.10and 8.11.(e) Write a routine to use the Gillespie algorithmto solve the discrete SZR model for eqns 6.96,keeping track of t, S, Z, and R for each event,ending when S = 0 or Z = 0, and adding an ex-tra point at tmax if the system terminates early.Write a routine numerically solve the continuumequations 6.95. Use β = 0.001, κ = 0.0008, andtmax = 5. (Should the zombies win?) Plot thetwo for initial conditions Z0 = 100, S0 = 9900,and R0 = 0 (a simultaneous outbreak of a hun-dred zombies). Is the continuum limit faithfullydescribing the behavior for large numbers of zom-bies and humans?Now let us examine the likelihood of zombies be-ing stamped out despite their advantage in bit-ing, if we start with only one zombie.(f) Plot the continuum solution with the zom-bie simulation for twenty initial conditions usingZ0 = 1, S0 = 9999, and R0 = 0. Are the simula-tions suffering from more fluctuations than theydid for larger number of zombies? Do you see

evidence for zombie extinction early in the out-break? What fraction of the initial outbreaks ap-pear to have killed off all the humans? Zoom inand plot at early times (Z ≤ 5, t < 0.5) and notea few trajectories where the first zombie is killedbefore biting, and trajectories where the zombiepopulation goes extinct after reaching a peak pop-ulation of two or three.We can estimate the probability P∞ext that a sin-gle zombie with bite rate larger than kill ratewill go extinct before taking over a large initialhuman population S0 →∞. As described in ref-erence [2], the probability Pext that the zombiesgo extinct, in the limit of many humans, is equalto the probability that the first one is destroyed,plus the probability that it bites first times theprobability that both zombie lines go extinct:

P∞ext =κ

β + κ+

ββ + κ

(P∞ext)2. (6.97)

This can be solved to show P∞ext = κ/β.Exactly this same argument holds for regular dis-ease outbreaks. Similar arguments can be usedto determine the likelihood that an advantageousgene mutation will take over a large population.(g) Was the fraction of extinctions you ob-served in part (f) roughly given by the calcula-tion above? Write a simpler routine that sim-ulates the Gillespie algorithm over n epidemics,reporting the fraction in which zombies go ex-tinct (observing only whether Z = 0 happens be-fore S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good isthe prediction? Draw a plot of Pext versus log S0,for S0 = 1, 2, 4, . . . , 512, using 1000 epidemicseach. How large must the human population bebefore our estimate P∞ext is within about 10% ofthe correct answer?

(6.22) Nucleosynthesis as a chemical reaction.76

(Astrophysics) ©3The very early Universe was so hot that anyheavier nuclei quickly evaporated into protonsand neutrons. Between a few seconds and a cou-ple of minutes after the Big Bang, protons andneutrons began to fuse into light nuclei – mostlyhelium. The energy barriers for conversion toheavier elements were too slow, however, by thetime they became entropically favorable. Almostall of the heavier elements on Earth were formedlater, inside stars.

76This exercise was developed in collaboration with Katherine Quinn.

Copyright Oxford University Press 2006 v2.0 --

Exercises 175

nonetheless derive this. Let the probability den-sity of event type #n be ρn(t), with survivalprobability Sn(t) = 1 −

∫ t

0ρn(τ )dτ . Let there

be two types of events.(d) Write the probability density of the firstevent, ρtot(t), in terms of ρ1, ρ2, S1, and S2.(The final answer should involve no integrals orderivatives.) Specialize to systems with constantrates, which have an exponentially decaying sur-vival time, Sn(t) = exp(−γnt). Show that thetotal event rate γtot is the sum γ1 + γ2. Showthat the probability of the next event being of type#1 is γ1/γtot.To simulate one step of our discrete SZR model,we

(i) find the total rate of events γtot,

(ii) increment t by ∆t, a random numberpulled from an exponential distributionwith decay rate γtot,

(iii) choose to bite or to kill by choosing arandom number uniform in (0, γtot), andchecking if it is less than γ1,

(iv) change S, Z, and R appropriately for theevent, and

(v) perform any observations needed.

This is a simple example of the Gillespie algo-rithm, discussed in more detail in Exercises 8.10and 8.11.(e) Write a routine to use the Gillespie algorithmto solve the discrete SZR model for eqns 6.96,keeping track of t, S, Z, and R for each event,ending when S = 0 or Z = 0, and adding an ex-tra point at tmax if the system terminates early.Write a routine numerically solve the continuumequations 6.95. Use β = 0.001, κ = 0.0008, andtmax = 5. (Should the zombies win?) Plot thetwo for initial conditions Z0 = 100, S0 = 9900,and R0 = 0 (a simultaneous outbreak of a hun-dred zombies). Is the continuum limit faithfullydescribing the behavior for large numbers of zom-bies and humans?Now let us examine the likelihood of zombies be-ing stamped out despite their advantage in bit-ing, if we start with only one zombie.(f) Plot the continuum solution with the zom-bie simulation for twenty initial conditions usingZ0 = 1, S0 = 9999, and R0 = 0. Are the simula-tions suffering from more fluctuations than theydid for larger number of zombies? Do you see

evidence for zombie extinction early in the out-break? What fraction of the initial outbreaks ap-pear to have killed off all the humans? Zoom inand plot at early times (Z ≤ 5, t < 0.5) and notea few trajectories where the first zombie is killedbefore biting, and trajectories where the zombiepopulation goes extinct after reaching a peak pop-ulation of two or three.We can estimate the probability P∞ext that a sin-gle zombie with bite rate larger than kill ratewill go extinct before taking over a large initialhuman population S0 →∞. As described in ref-erence [2], the probability Pext that the zombiesgo extinct, in the limit of many humans, is equalto the probability that the first one is destroyed,plus the probability that it bites first times theprobability that both zombie lines go extinct:

P∞ext =κ

β + κ+

ββ + κ

(P∞ext)2. (6.97)

This can be solved to show P∞ext = κ/β.Exactly this same argument holds for regular dis-ease outbreaks. Similar arguments can be usedto determine the likelihood that an advantageousgene mutation will take over a large population.(g) Was the fraction of extinctions you ob-served in part (f) roughly given by the calcula-tion above? Write a simpler routine that sim-ulates the Gillespie algorithm over n epidemics,reporting the fraction in which zombies go ex-tinct (observing only whether Z = 0 happens be-fore S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good isthe prediction? Draw a plot of Pext versus log S0,for S0 = 1, 2, 4, . . . , 512, using 1000 epidemicseach. How large must the human population bebefore our estimate P∞ext is within about 10% ofthe correct answer?

(6.22) Nucleosynthesis as a chemical reaction.76

(Astrophysics) ©3The very early Universe was so hot that anyheavier nuclei quickly evaporated into protonsand neutrons. Between a few seconds and a cou-ple of minutes after the Big Bang, protons andneutrons began to fuse into light nuclei – mostlyhelium. The energy barriers for conversion toheavier elements were too slow, however, by thetime they became entropically favorable. Almostall of the heavier elements on Earth were formedlater, inside stars.

76This exercise was developed in collaboration with Katherine Quinn.

Exercises 189

Answer Fig. 1 Discrete vs. continuum solutions of SZR equations.

Now let us examine the likelihood of zombies being stamped out despite their advantage in biting, if westart with only one zombie.(f) Plot the continuum solution with the zombie simulation for twenty initial conditions using Z0 = 1,S0 = 9999, and R0 = 0. Are the simulations su↵ering from more fluctuations than they did for largernumber of zombies? Do you see evidence for zombie extinction early in the outbreak? What fraction of theinitial outbreaks appear to have killed o↵ all the humans? Zoom in and plot at early times (Z 5, t < 0.5)and note a few trajectories where the first zombie is killed before biting, and trajectories where the zombiepopulation goes extinct after reaching a peak population of two or three.

Answer Fig. 2 Do the zombies get stamped out?. Four of the trajectories have the zombies win, in this simulationof twenty trajectories. It appears as if the humans have hope.

The simulations are fluctuating significantly more. Specifically, the majority appear to have stomped outthe zombies before the outbreak got going (below).

Exercises 190

Answer Fig. 3 Zombies dying out at early times.

We can estimate the probability P1

ext that a single zombie with bite rate larger than kill rate will go extinctbefore taking over a large initial human population S0 ! 1. As described in reference [1], the probabilityPext that the zombies go extinct, in the limit of many humans, is equal to the probability that the first oneis destroyed, plus the probability that it bites first times the probability that both zombie lines go extinct:

P1

ext =

� + +

�� +

(P1

ext)2. (6.26)

This can be solved to show P1

ext = /�.Exactly this same argument holds for regular disease outbreaks. Similar arguments can be used to determinethe likelihood that an advantageous gene mutation will take over a large population.(g) Was the fraction of extinctions you observed in part (f) roughly given by the calculation above? Writea simpler routine that simulates the Gillespie algorithm over n epidemics, reporting the fraction in whichzombies go extinct (observing only whether Z = 0 happens before S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good is the prediction? Draw a plot of Pext versus logS0, for S0 = 1,2, 4, . . . , 512, using 1000 epidemics each. How large must the human population be before our estimate P1

ext

is within about 10% of the correct answer?

For the simulation presented in part (f), four out of twenty is 20% = 1� 0.8, precisely as predicted.

Answer Fig. 4 Zombie extinction probabilityversus the initial zombie population.

The extinction probability goes down for lower human populations, but one must go down to roughly ten

4

Copyright Oxford University Press 2006 v2.0 --

Exercises 175

nonetheless derive this. Let the probability den-sity of event type #n be ρn(t), with survivalprobability Sn(t) = 1 −

∫ t

0ρn(τ )dτ . Let there

be two types of events.(d) Write the probability density of the firstevent, ρtot(t), in terms of ρ1, ρ2, S1, and S2.(The final answer should involve no integrals orderivatives.) Specialize to systems with constantrates, which have an exponentially decaying sur-vival time, Sn(t) = exp(−γnt). Show that thetotal event rate γtot is the sum γ1 + γ2. Showthat the probability of the next event being of type#1 is γ1/γtot.To simulate one step of our discrete SZR model,we

(i) find the total rate of events γtot,

(ii) increment t by ∆t, a random numberpulled from an exponential distributionwith decay rate γtot,

(iii) choose to bite or to kill by choosing arandom number uniform in (0, γtot), andchecking if it is less than γ1,

(iv) change S, Z, and R appropriately for theevent, and

(v) perform any observations needed.

This is a simple example of the Gillespie algo-rithm, discussed in more detail in Exercises 8.10and 8.11.(e) Write a routine to use the Gillespie algorithmto solve the discrete SZR model for eqns 6.96,keeping track of t, S, Z, and R for each event,ending when S = 0 or Z = 0, and adding an ex-tra point at tmax if the system terminates early.Write a routine numerically solve the continuumequations 6.95. Use β = 0.001, κ = 0.0008, andtmax = 5. (Should the zombies win?) Plot thetwo for initial conditions Z0 = 100, S0 = 9900,and R0 = 0 (a simultaneous outbreak of a hun-dred zombies). Is the continuum limit faithfullydescribing the behavior for large numbers of zom-bies and humans?Now let us examine the likelihood of zombies be-ing stamped out despite their advantage in bit-ing, if we start with only one zombie.(f) Plot the continuum solution with the zom-bie simulation for twenty initial conditions usingZ0 = 1, S0 = 9999, and R0 = 0. Are the simula-tions suffering from more fluctuations than theydid for larger number of zombies? Do you see

evidence for zombie extinction early in the out-break? What fraction of the initial outbreaks ap-pear to have killed off all the humans? Zoom inand plot at early times (Z ≤ 5, t < 0.5) and notea few trajectories where the first zombie is killedbefore biting, and trajectories where the zombiepopulation goes extinct after reaching a peak pop-ulation of two or three.We can estimate the probability P∞ext that a sin-gle zombie with bite rate larger than kill ratewill go extinct before taking over a large initialhuman population S0 →∞. As described in ref-erence [2], the probability Pext that the zombiesgo extinct, in the limit of many humans, is equalto the probability that the first one is destroyed,plus the probability that it bites first times theprobability that both zombie lines go extinct:

P∞ext =κ

β + κ+

ββ + κ

(P∞ext)2. (6.97)

This can be solved to show P∞ext = κ/β.Exactly this same argument holds for regular dis-ease outbreaks. Similar arguments can be usedto determine the likelihood that an advantageousgene mutation will take over a large population.(g) Was the fraction of extinctions you ob-served in part (f) roughly given by the calcula-tion above? Write a simpler routine that sim-ulates the Gillespie algorithm over n epidemics,reporting the fraction in which zombies go ex-tinct (observing only whether Z = 0 happens be-fore S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good isthe prediction? Draw a plot of Pext versus log S0,for S0 = 1, 2, 4, . . . , 512, using 1000 epidemicseach. How large must the human population bebefore our estimate P∞ext is within about 10% ofthe correct answer?

(6.22) Nucleosynthesis as a chemical reaction.76

(Astrophysics) ©3The very early Universe was so hot that anyheavier nuclei quickly evaporated into protonsand neutrons. Between a few seconds and a cou-ple of minutes after the Big Bang, protons andneutrons began to fuse into light nuclei – mostlyhelium. The energy barriers for conversion toheavier elements were too slow, however, by thetime they became entropically favorable. Almostall of the heavier elements on Earth were formedlater, inside stars.

76This exercise was developed in collaboration with Katherine Quinn.

Exercises 190

Answer Fig. 3 Zombies dying out at early times.

We can estimate the probability P1

ext that a single zombie with bite rate larger than kill rate will go extinctbefore taking over a large initial human population S0 ! 1. As described in reference [1], the probabilityPext that the zombies go extinct, in the limit of many humans, is equal to the probability that the first oneis destroyed, plus the probability that it bites first times the probability that both zombie lines go extinct:

P1

ext =

� + +

�� +

(P1

ext)2. (6.26)

This can be solved to show P1

ext = /�.Exactly this same argument holds for regular disease outbreaks. Similar arguments can be used to determinethe likelihood that an advantageous gene mutation will take over a large population.(g) Was the fraction of extinctions you observed in part (f) roughly given by the calculation above? Writea simpler routine that simulates the Gillespie algorithm over n epidemics, reporting the fraction in whichzombies go extinct (observing only whether Z = 0 happens before S = 0, ignoring the time and the trajectory).For S0 = 9999 and 1000 epidemics, how good is the prediction? Draw a plot of Pext versus logS0, for S0 = 1,2, 4, . . . , 512, using 1000 epidemics each. How large must the human population be before our estimate P1

ext

is within about 10% of the correct answer?

For the simulation presented in part (f), four out of twenty is 20% = 1� 0.8, precisely as predicted.

Answer Fig. 4 Zombie extinction probabilityversus the initial zombie population.

The extinction probability goes down for lower human populations, but one must go down to roughly ten

5 Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

6

Page 2: n t n Copyright Oxford University Press 2006 v2.0

9/13/21

2

Copyright Oxford University Press 2006 v2.0 --

Exercises 41

(d) How many of these solutions can you ruleout by inspection (without doing a calculation)?In particular, diffusion

• Conserves density: ρ is neither created or de-stroyed

• Does not mix wavelengths: the differentwavevectors ρ(k) evolve separately

• Evolves short wavelengths faster than longwavelengths

• Is symmetric under inversion x↔ −xWhich of these basic properties of diffusion ruleout which of the answers?

(2.7) Periodic diffusion. ©2Consider a one-dimensional diffusion equation∂ρ/∂t = D∂2ρ/∂x2, with initial condition pe-riodic in space with period L, consisting ofa δ-function at every xn = nL: ρ(x, 0) =∑∞

n=−∞ δ(x− nL).(a) Using the Green’s function method, give anapproximate expression for the the density, validat short times and for −L/2 < x < L/2, involv-ing only one term (not an infinite sum). (Hint:How many of the Gaussians are important in thisregion at early times?)(b) Using a Fourier series,36 give an approx-imate expression for the density, valid at longtimes, involving only two terms (not an infinitesum). (Hint: How many of the wavelengths areimportant at late times?)(c) Give a characteristic time τ in terms of Land D, such that your answer in (a) is valid fort$ τ and your answer in (b) is valid for t% τ .

(2.8) Thermal diffusion. ©2The rate of energy flow in a material with ther-mal conductivity kt and a temperature fieldT (x, y, z, t) = T (r, t) is J = −kt∇T .37 Energy islocally conserved, so the energy density E satis-fies ∂E/∂t = −∇ · J.(a) If the material has constant specific heat cpand density ρ, so E = cpρT , show that thetemperature T satisfies the diffusion equation∂T/∂t = kt/(cpρ)∇2T .(b) By putting our material in a cavity with mi-crowave standing waves, we heat it with a pe-riodic modulation T = sin(kx) at t = 0, at

which time the microwaves are turned off. Showthat the amplitude of the temperature modula-tion decays exponentially in time. How doesthe amplitude decay rate depend on wavelengthλ = 2π/k?

(2.9) Frying pan. ©2An iron frying pan is quickly heated on a stovetop to 400 degrees Celsius. Roughly how longit will be before the handle is too hot to touch(within, say, a factor of two)? (Adapted from[149, p. 40].)Do this three ways.(a) Guess the answer from your own experience.If you have always used aluminum pans, consulta friend or parent.(b) Get a rough answer by a dimensional ar-gument. You need to transport heat cpρV∆Tacross an area A = V/∆x. How much heat willflow across that area per unit time, if the temper-ature gradient is roughly assumed to be ∆T/∆x?How long δt will it take to transport the amountneeded to heat up the whole handle?(c) Model the problem as the time needed for apulse of heat at x = 0 on an infinite rod to spreadout a root-mean-square distance σ(t) equal tothe length of the handle, and use the Green’sfunction for the heat diffusion equation (Exer-cise 2.8).Note: For iron, the specific heat cp = 450 J/(kgC), the density ρ = 7900 kg/m3, and the thermalconductivity kt = 80W/(m C).

(2.10) Polymers and random walks.38 (Computa-tion, Condensed matter) ©3Polymers are long molecules, typically made ofidentical small molecules called monomers thatare bonded together in a long, one-dimensionalchain. When dissolved in a solvent, the polymerchain configuration often forms a good approxi-mation to a random walk. Typically, neighbor-ing monomers will align at relatively small an-gles; several monomers are needed to lose mem-ory of the original angle. Instead of modelingall these small angles, we can produce an equiv-alent problem focusing all the bending in a fewhinges; we approximate the polymer by an un-correlated random walk of straight segments sev-

36You can use a Fourier transform, but you will find ρ(k, 0) is zero except at the values k = 2πm/L, where it is a δ-function.37We could have derived this law of thermal conductivity from random walks of phonons, but we have not done so.38A link to the software can be found at the book Web site [167].39Some seem to define the persistence length with a different constant factor.

Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

Copyright Oxford University Press 2006 v2.0 --

40 Random walks and emergent properties

Gaussian or normal probability distribution asN →∞,

ρ(x) =1√2πσ

exp(−x2/2σ2), (2.34)

with σ =√Na.

(c) Calculate the RMS step-size a for one-dimensional steps uniformly distributed in(−1/2, 1/2). Write a routine that plots a his-togram of the endpoints of W one-dimensionalrandom walks with N steps and 50 bins, alongwith the prediction of eqn 2.34, for x in(−3σ, 3σ). Do a histogram with W = 10 000 andN = 1, 2, 3, and 5. How quickly does the Gaus-sian distribution become a good approximation tothe random walk?

(2.6) Fourier and Green. ©2An initial density profile ρ(x, t = 0) is per-turbed slightly away from a uniform density ρ0,as shown in Fig. 2.11. The density obeys thediffusion equation ∂ρ/∂t = D∂2ρ/∂x2, whereD = 0.001m2/s. The lump centered at x0 = 5is a Gaussian exp(−(x − x0)

2/2)/√2π, and the

wiggle centered at x = 15 is a smooth envelopefunction multiplying cos(10x).(a) Fourier. As a first step in guessing how thepictured density will evolve, let us consider just acosine wave. If the initial wave were ρcos(x, 0) =cos(10x), what would it be at t = 10 s? Relatedformulæ: ρ(k, t) = ρ(k, t′)G(k, t − t′); G(k, t) =exp(−Dk2t).(b) Green. As a second step, let us check howlong an initial δ-function would take to spreadout as far as the Gaussian on the left. Ifthe wave at some earlier time −t0 were a δ-function at x = 0, ρ(x,−t0) = δ(x), what choiceof the time elapsed t0 would yield a Gaussianρ(x, 0) = exp(−x2/2)/

√2π for the given dif-

fusion constant D = 0.001m2/s? Relatedformulæ: ρ(x, t) =

∫ρ(y, t′)G(y − x, t − t′) dy;

G(x, t) = (1/√4πDt) exp(−x2/(4Dt)).

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

0) - ρ 0

Fig. 2.11 Initial profile of density deviation fromaverage.

(c) Pictures. Now consider time evolution forthe next ten seconds. The initial density pro-file ρ(x, t = 0) is as shown in Fig. 2.11. Whichof the choices (A)–(E) represents the density att = 10 s? (Hint: Compare t = 10 s to the timet0 from part (b).) Related formulæ: 〈x2〉 ∼ 2Dt.

(A)

10 15 20 25 30Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(B)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(C)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(D)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

(E)

0 5 10 15 20Position x

-0.4

0

0.4

ρ(x,

t =

10) -

ρ0

7