Final Project

Since we have learned some Random Walk theory in Statistical Physics, I chose this Chapter for my final project.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Random Walk

Abstract

? In this project, I use the Random number generator for simulating the random walk.Every random system has a complicated trajectory, and it can be seen as a typical "Random Walk" in every direction. This is a progress in which "a walker" moves one step or none at a time.Hence, we can use this simple model to higher-dimension random system, such as diffusion.

Background
random phenomena

A random walk is a mathematical object which describes a path that consists of a succession of random steps. For example, the path traced by a molecule as it travels in a liquid or a gas, the search path of a foraging animal, superstring behavior, the price of a fluctuating stock and the financial status of a gambler can all be approximated by random walk models, even though they may not be truly random in reality. Random walks explain the observed behaviors of many processes in these fields, and thus serve as a fundamental model for the recorded stochastic activity.


Main Body

Diffusion is the net movement of molecules or atoms from a region of high concentration (or high chemical potential) to a region of low concentration (or low chemical potential).

1 Simple random walk

The simplest situation involves a walker that is able to take steps of length unity along a line. With the same probability of 1/2, we can see the distance will stay around 0 as thefigure shows .below.

Here is the code


Actually, since the random number is not always the same, we can get a little difference in twice simulation.That's the ?fluctuation in statistical physics.

In diffusion situation, there is an interesting and informative quantity is <x^2>,the averange of the square of the displacement after n steps.We can discribe it as

where t is the time, ?which here is just equal to the step number; and D is known as the diffusion constant.The simulation below can show the linear relation between <x^2> and t

Here is the code


2 Typical example:Diffusion

? ?As we metioned, random walks are equivalent to diffusion.We have

In one dimensional situation, we can approach this function as


Then we can set the initial parameters and use the progressive relationship to simulate the relation between density and time.

Here is the code

In the gif,we can see the every step change.


After the process, we can set the time to get a final result/

and we can see it in the three dimensional way

Actually, the density follows the function

where the "sigma" is "time" dependent It's a kind of Gaussian distribution, the simulation is corresponding with this function. We can see ?that when time becomes longer the ?curve will become wider and placid. That's consistent with theoretical ?situation.

Additional: entropy

When a sugar resolves in a cup of water, we can see the diffusion process as a random phenomena.


As we can see, when time increases, the entropy value increases, but its growth speed is reduced. Eventually it will converge to a constant value.

Conclusion

For such equal possibility random walk, through simulation, we can find that the averange of ?a random behavior is around zero.And the square of x is linear to t with equal probability.

About the relationship between density and time, when time becomes longer the ?curve will become wider and placid.

As for entropy, the the entropy value increases, but its growth speed is reduced. Eventually it will converge to a constant value.

Acknowledgement

python畫三維圖的方法

matplotlib使用教程财松、和用python畫動圖的animation

制作GIF的摳摳視頻秀

熱統(tǒng)教材 statistical and thermal physics 以及本課程教材 computational physics

非常感謝蔡老師這種網(wǎng)絡(luò)共享的作業(yè)方式,我作為一個基本不會編程語言的學(xué)生,通過一學(xué)期的學(xué)習(xí)和觀看借鑒其他同學(xué)的代碼每聪,應(yīng)該算對python這種語言初步有了了解,希望這種方式可以一直延續(xù)下去晓锻。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末收夸,一起剝皮案震驚了整個濱河市途事,隨后出現(xiàn)的幾起案子萍膛,更是在濱河造成了極大的恐慌吭服,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,997評論 6 502
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蝗罗,死亡現(xiàn)場離奇詭異艇棕,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)串塑,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,603評論 3 392
  • 文/潘曉璐 我一進(jìn)店門欠肾,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人拟赊,你說我怎么就攤上這事〈饬埽” “怎么了吸祟?”我有些...
    開封第一講書人閱讀 163,359評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長桃移。 經(jīng)常有香客問我屋匕,道長,這世上最難降的妖魔是什么借杰? 我笑而不...
    開封第一講書人閱讀 58,309評論 1 292
  • 正文 為了忘掉前任过吻,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘纤虽。我一直安慰自己乳绕,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,346評論 6 390
  • 文/花漫 我一把揭開白布逼纸。 她就那樣靜靜地躺著洋措,像睡著了一般。 火紅的嫁衣襯著肌膚如雪杰刽。 梳的紋絲不亂的頭發(fā)上菠发,一...
    開封第一講書人閱讀 51,258評論 1 300
  • 那天,我揣著相機(jī)與錄音贺嫂,去河邊找鬼滓鸠。 笑死,一個胖子當(dāng)著我的面吹牛第喳,可吹牛的內(nèi)容都是我干的糜俗。 我是一名探鬼主播,決...
    沈念sama閱讀 40,122評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼墩弯,長吁一口氣:“原來是場噩夢啊……” “哼吩跋!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起渔工,我...
    開封第一講書人閱讀 38,970評論 0 275
  • 序言:老撾萬榮一對情侶失蹤锌钮,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后引矩,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體梁丘,經(jīng)...
    沈念sama閱讀 45,403評論 1 313
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,596評論 3 334
  • 正文 我和宋清朗相戀三年旺韭,在試婚紗的時候發(fā)現(xiàn)自己被綠了氛谜。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,769評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡区端,死狀恐怖值漫,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情织盼,我是刑警寧澤杨何,帶...
    沈念sama閱讀 35,464評論 5 344
  • 正文 年R本政府宣布,位于F島的核電站沥邻,受9級特大地震影響危虱,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜唐全,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,075評論 3 327
  • 文/蒙蒙 一埃跷、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦弥雹、人聲如沸垃帅。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,705評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽挺智。三九已至,卻和暖如春窗宦,著一層夾襖步出監(jiān)牢的瞬間赦颇,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,848評論 1 269
  • 我被黑心中介騙來泰國打工赴涵, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留媒怯,地道東北人。 一個月前我還...
    沈念sama閱讀 47,831評論 2 370
  • 正文 我出身青樓髓窜,卻偏偏與公主長得像扇苞,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子寄纵,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,678評論 2 354

推薦閱讀更多精彩內(nèi)容