Skip to Main Content
Mathematica 錦囊妙計
book

Mathematica 錦囊妙計

by Sal Mangano
April 2014
Beginner to intermediate content levelBeginner to intermediate
830 pages
15h 21m
Chinese
GoTop Information, Inc.
Content preview from Mathematica 錦囊妙計
498
|
第十二章
解決方案
最有名之一的隨機過程為隨機漫步(random walk),隨機漫步可以發生在一維、二維、
三維或更高維度的空間中,但一維或二維較容易以視覺化呈現。以下範例為一粒子(或
比喻為醉漢)於二維晶格中隨機亂步,由原點
{0,0}
開始,每次可朝東
{1,0}
、西
{-1,0}
{0,-1}
{0,1
} 其中一個方向前進一格。[Page-500]
只需指定步數即可輸出粒子的漫步軌跡,並且可使用
ListLinePlot
指令視覺化呈現,或
如下圖使用箭頭顯示每一步前進歷程。以下使用
SeedRandom
指令設定亂數種子,以確保
在本書印刷前所跑的每次模擬是相同的!
ch12.indd 498 2014/4/2 下午 01:58:08
12.16 模擬隨機過程(Stochastic Process
|
499
討論說明
有的模擬對於下一步包含某些限制,例如模擬一個不能後退的隨機亂步,這時候需記憶
前一步的移動,並將其反向移動於下一步中刪除。[Page-501]
將前一步(lase)初始化為不允許的方向,
以避免誤刪第一步的可能方向
使用 complement 指令將上一步的反向移動從下一步中剔除
ch12.indd 499 2014/4/7 下午 12:54:00
500
|
第十二章
你通常會想了
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ubuntu for Non-Geeks, 4th Edition

Ubuntu for Non-Geeks, 4th Edition

Rickford Grant, Phil Bull

Publisher Resources

ISBN: 9789863470106