• The added line is THIS COLOR.
  • The deleted line is THIS COLOR.
* ILASセミナー :化学工学的思考で身の回りを見る(後半) [#y4061f5a]
#freeze
* Stochastic Processes: Data Analysis and Computer Simulation [#j45b7376]


** 基本情報 [#h013a198]
** About the course [#l6be16db]

- [[シラバス:https://www.k.kyoto-u.ac.jp/teacher/la/syllabus/detail?condition.courseType=&condition.seriesName=&condition.familyFieldName=&condition.lectureStatusNo=1&condition.langNum=&condition.semester=&condition.targetStudent=0&condition.courseTitle=&condition.courseTitleEn=&condition.teacherName=%8E%52%96%7B%81%40%97%CA%88%EA&condition.teacherNameEn=&condition.itemInPage=10&condition.syutyu=false&condition.lectureCode=&page=1#3]]
:''Course Number''| 
::009x|

- 演習室(主): 物理系校舎情報処理演習室1
:''Brief Description'' | 
::The course deals with how to simulate and analyze stochastic processes, in particular the dynamics of small particles diffusing in a fluid.|

- 教室 (副): 総合研究9号館(旧工学部3号館)W301
:''Full Description'' | 
::The motion of falling leaves or small particles diffusing in a fluid is highly stochastic in nature. Therefore, such motions must be modeled as stochastic processes, for which exact predictions are no longer possible. This is in stark contrast to the deterministic motion of planets and stars, which can be perfectly predicted using celestial mechanics. This course is an introduction to stochastic processes through numerical simulations, with a focus on the proper data analysis needed to interpret the results. We will use the Jupyter (iPython) notebook as our programming environment. It is freely available for Windows, Mac, and Linux through the Anaconda Python Distribution. The students will first learn the basic theories of stochastic processes. Then, they will use these theories to develop their own python codes to perform numerical simulations of small particles diffusing in a fluid. Finally, they will analyze the simulation data according to the theories presented at the beginning of course. At the end of the course, we will analyze the dynamical data of more complicated systems, such as financial markets or meteorological data, using the basic theory of stochastic processes.|

- 後半担当教員: 山本量一 教授
:''What You’ll Learn'' | 
::Basic Python programming|
::Basic theories of stochastic processes|
::Simulation methods for a Brownian particle|
::Application: analysis of financial data|

** 後半の内容 [#i45956cc]
:''Learner Testimonial'' | 
::None|

- メディアセンター演習室のPCを用いて化学工学に関する簡単なプログラミングを行います.
:''Course Dates'' | 
::Starts on 30 March, 2017|

- 初回に演習室のPC端末で使用するUSBを配布します.面倒ですが毎回持参してください.USB単体でiPython Notebook (Jupyter)が動くようにしてあります.
:''Course Length'' | 
::6 weeks|

- 実はUSBがなくても,WEBサイト[[tmpnb:https://tmpnb.org/]]を開くとJupyterが試用できます.USBを忘れた時はこちらを使用してください.
:''Estimated Effort'' | 
::2-3 hours per week|

- 授業ではこのJupyterを使い,擬似乱数の発生からはじめてブラウン運動のシミュレーションをやり,確率過程についての理解を深めることを最終目標とします.
:''Prerequisites'' | 
::Basic mathematics expected of a 2nd year undergraduate student (differential and integral calculus and linear algebra).|

- 確率過程の考え方は,物理学や化学工学に限らず,世の中の複雑な現象(株価,気象,…)を数学的に扱う場合に威力を発揮します.
:''Language'' | 
:: Content: English|
:: Videos: English|

** 技術情報 [#c14feb02]
:''Course Level'' | 
:: Intermediate|

- [[PC端末の利用:http://www.iimc.kyoto-u.ac.jp/ja/services/ecs/terminal/]]
:''Certificate Type and Price'' | 
::TBA|

- [[Python入門:http://www.tohoho-web.com/python/]]
:''XSeries'' | 
::No|

- [[jupyter (iPython Notebook):http://jupyter.org/]]
:''Course Staff'' | 
::''Ryoichi Yamamoto''|
:::Ryoichi was born in Ishikawa Prefecture, Japan in 1965. He obtained his B. Eng. (1988) and M.Eng. (1992) degrees from Kobe University and Ph.D. (1996) degree from Kyoto University. He was a research associate at Kobe University (1994--1996), a research associate (1996–-1999) and a lecturer (2000--2004) at the Department of Physics, Kyoto University, an associate professor at the Department of Chemical Engineering, Kyoto University (2004--2008). Since 2008, he has been a professor there. He works on dynamical problems of soft matters (complex fluids, glasses, polymers, and colloids) and active matters (micro-swimmers and cells) by developing and using novel methods of computer simulations suitable for those systems.|
::''John J. Molina''|
:::John was born in Bogota, Colombia in 1983. He obtained his B. Sci. from the Andes University (2007), M. Sci. from the ENS-Lyon (2008), and Ph.D. from the University of Paris 6 - UPMC (2011). He joined Kyoto University as a research fellow in 2011, and since 2014 he is an assistant professor in the Department of Chemical Engineering. He is focused on studying the dynamics of soft-matter systems using computer simulations.|
::Areas of Expertise: |
:::Soft Matter Science|
:::Computational Science|
:::Transport Phenomena|
::Major Works:|
:::Hydrodynamic interactions of self-propelled swimmers, John J. Molina, Yasuya Nakayama, and Ryoichi Yamamoto.|
:::Dynamics of Highly Supercooled Liquids; Heterogeneity, Rheology, and Diffusion, Ryoichi Yamamoto and Akira Onuki.|
::Connect:|
:::website: http://www-tph.cheme.kyoto-u.ac.jp/index.php?en%2FFrontPage|
:::facebook:https://www.facebook.com/groups/1158492977603546/ |

- その他,ググればたくさん情報があります.それらを有効に活用してください.
** Trailers [#tfd66dc6]

-- Jupyterの使い方の簡単な紹介.
http://myenigma.hatenablog.com/entry/2016/02/20/183423
- trailer [ [[youtube:https://www.youtube.com/watch?v=hq-otcUbJkY]] ]
- welcome [ [[youtube:https://www.youtube.com/watch?v=9AZUwpohLvo]] ]

-- グラフを書ために matplolib を使います.授業では基礎的な機能だけ使いますが,やり方次第でいろんなことが出来ます.
http://cflat-inc.hatenablog.com/entry/2014/03/17/214719
** Lecture contents [#pc541bf0]

** 講義内容 [#y3c57198]

- 6/08 1.演習「プログラミングの準備」 
[ [[''Go'':https://nbviewer.jupyter.org/url/www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/01_practice.ipynb]] ]
- ''How to follow each Part''
-- Download all files (must do for each week) [ [[github:https://github.com/ryo0921/KyotoUx-009x]] ] -> "Clone or download" -> "Download ZIP" -> Extract the downloaded zip in your local working directory to create all necessary files for that week. Be careful of overwriting the files used in previous weeks.

- 6/15 2.講義「Brown運動のシミュレーション」
[ [[''PDF'':http://www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/02_Brownian_motion.pdf]] ] (この日のみ学術情報メディアセンター南館202)
-- Method 1 (easier)
--- You can start the downloaded jupyter notebooks in your web browser by simply typing the following command, where #1 and #2 represent the week and part numbers you are following.
  jupyter notebook 009x_#1#2.ipynb
--- Then watch the corresponding video.

- 6/22 3.演習「常微分方程式の数値解法(オイラー法)」 
[ [[''Go'':https://nbviewer.jupyter.org/url/www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/03_damped_oscillation.ipynb]] ]
-- Method 2 (harder but more useful to learn programming)
--- You can start a new blank jupyter notebook by typing the following command before watching each video.
  jupyter notebook
--- Refer to one of the Notebooks provided via nbviewer and github while watching the video. You can find the links to the Notebooks under each video.
--- Then you can type the code and commands (or copy and paste from the Notebook to the corresponding cells) directly in the blank jupyter notebook to reproduce the code presented in class.

- 6/29 4.演習「種々の確率分布関数」 
[ [[''Go'':https://nbviewer.jupyter.org/url/www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/04_distribution_function.ipynb]] ]
- ''Week1: Python programming for beginners''

- 7/06 5.演習「Brown運動のシミュレーション」 
[ [[''Go'':https://nbviewer.jupyter.org/url/www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/05_brownian_3D_simulation.ipynb]] ]
-- 1. Using Python, iPython, and Jupyter notebook 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/01/009x_11.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_11.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_11.pdf]] ]

- 7/13 6.演習「Brown運動の解析」 
[ [[''Go'':https://nbviewer.jupyter.org/url/www-tph.cheme.kyoto-u.ac.jp/p/ryoichi/lec/ilas2/05_brownian_3D_simulation.ipynb#6.-Brown%E9%81%8B%E5%8B%95%E3%81%AE%E8%A7%A3%E6%9E%90]] ]
-- 2. Making graphs with matplotlib 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/01/009x_12.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_12.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_12.pdf]] ]

- 7/20 7.課題研究 
[ [[''Go''>ry/Ilas2_07]] ]
-- 3. The Euler method for numerical integration
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/01/009x_13.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_13.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_13.pdf]] ]

-- 4. Simulating a damped harmonic oscillator 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/01/009x_14.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_14.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/01/009x_14.pdf]] ]

** 課題レポート [#xfad5940]
- ''Week2: Distribution function and random number''

- 各回の宿題を課題レポートとする.
-- 1. Stochastic variable and distribution functions
[ Notebook: [[pptx:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_21.pptx]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_21.pdf]] ]

- 提出者: [[一覧>ry/Ilas2Rep]]
-- 2. Generating random numbers with Gaussian/binomial/Poisson distributions 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/02/009x_22.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_22.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_22.pdf]] ]

- 提出先: yamamoto.ryoichi.6m@kyoto-u.ac.jp (必要に応じて適宜ファイルをメールに添付してください.)
-- 3. The central limit theorem 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/02/009x_23.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_23.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_23.pdf]] ]
[ Supplemental_note_2-3: [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/Supplemental_note_2-3.pdf]] ]

- 考察が必要なものについては必ず考察を記載すること.
-- 4. Random walk 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/02/009x_24.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_24.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/02/009x_24.pdf]] ]

- レポートを提出した人は,必ずメール送信の3日後以降に,上の「提出者一覧」に名前があるか確認すること.
- ''Week3: Brownian motion 1: basic theories''

- メールの本文に「氏名」と「学籍番号」を忘れずに.授業に関する要望・感想があれば遠慮せずに書いてください.
-- 1. Basic knowledge of stochastic processes
[ Notebook: [[pptx:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_31.pptx]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_31.pdf]] ]

-- 2. Brownian motion and the Langevin equation
[ Notebook: [[pptx:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_32.pptx]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_32.pdf]] ]

-- 3. The linear response theory and the Green-Kubo formula
[ Notebook: [[pptx:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_33.pptx]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/03/009x_33.pdf]] ]


- ''Week4: Brownian motion 2: computer simulation''

-- 1. Random force in the Langevin equation 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/04/009x_41.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_41.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_41.pdf]] ]
[ Supplemental_note_4-1: [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/Supplemental_note_4-1.pdf]] ]

-- 2. Simple Python code to simulate Brownian motion 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/04/009x_42.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_42.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_42.pdf]] ]

-- 3. Simulations with on-the-fly animation
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/04/009x_43.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_43.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/04/009x_43.pdf]] ]

- ''Week5: Brownian motion 3: data analyses''

-- 1. Distribution and time correlation 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/05/009x_51.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_51.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_51.pdf]] ]
[ Supplemental_note_5-1: [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/Supplemental_note_5-1.pdf]] ]

-- 2. Mean square displacement and diffusion constant
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/05/009x_52.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_52.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_52.pdf]] ]

-- 3. Interacting Brownian particles 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/05/009x_53.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_53.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/05/009x_53.pdf]] ]

- ''Week6: Stochastic processes in the real world''

-- 1. Time variations and distributions of real world processes
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/06/009x_61.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_61.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_61.pdf]] ]

-- 2. A Stochastic Dealer Model I 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/06/009x_62.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_62.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_62.pdf]] ]

-- 3. A Stochastic Dealer Model II 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/06/009x_63.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_63.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_63.pdf]] ]

-- 4. A Stochastic Dealer Model III 
[ Notebook: [[nbviewer:https://nbviewer.jupyter.org/github/ryo0921/KyotoUx-009x/blob/master/06/009x_64.ipynb]]
/ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_64.ipynb]]
/ [[pdf:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/009x_64.pdf]] ]

-- Download simulation results to be performed in 6-2, 6-3, and 6-4, and Stock price data used in 6-4  [ [[github:https://github.com/ryo0921/KyotoUx-009x/blob/master/06/simulation_data.zip]] ] -> Download -> Extract in your local working directory to create 4 ".txt" and 2 ".csv" files.

** Useful Information [#pdaabe84]

- Download Python and set up a programming environment on your [Windows/Mac/Linux] PC [ [[''Go''>ry/en/StochasticProcessesAnaconda]] ]

- Python 3 official documentation [ [[''Go'':https://docs.python.org/3/]] ]

- Jupyter official website [ [[''Go'':http://jupyter.org/]] ]

- Related online resources

-- edX "Introduction to Computer Science and Programming Using Python" [ [[''Go'':https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-9]] ]

- What I have done to make my slide presentations

-- Install anaconda "Anaconda3-4.4.0-MacOSX-x86_64.pkg" downloaded from https://repo.continuum.io/archive/ .
-- Install RISE (v.5.0.0) by following the instructions found in https://github.com/damianavila/RISE .
 conda install -c damianavila82 rise
-- Install notebook extensions by following the instructions found in http://qiita.com/Tsutomu-KKE@github/items/1326e05eb992a8aa849d . Then you can use a spell checker etc...
 conda install -y -c conda-forge jupyter_contrib_nbextensions
//-- Replace "main.css" and "main.js" found in ~/anaconda/share/jupyter/nbextensions/rise/ with the same fine you can find in (dropbox)/00common/RISE_customize/ . This is needed to fit slides with bigpad.
-- Install additional packages
 conda install -c menpo ffmpeg
 conda install pandas-datareader
-- Update all packages
 conda update conda
 conda update anaconda
// conda update python
// conda update --all
--  Modified "~/.jupyter/jupyter_notebook_config.py" by nu-commenting the following line
 c.NotebookApp.browser = u'Safari'
-- Launch *.ipynb using Safari, display full screen, click the "RISE presentation icon"