Difference between revisions of "Physics 212, 2019: Computational Modeling For Scientists And Engineers"

From Ilya Nemenman: Theoretical Biophysics @ Emory
Jump to: navigation, search
(Lecture Notes and Detailed Schedule)
(Lecture Notes and Detailed Schedule)
Line 55: Line 55:
 
:'''Feb 6''': [[Physics 212, 2019: Lecture 7|Lecture 7]], Euler method for solving ordinary differential equations. Bacterial growth. Accuracy of algorithms.
 
:'''Feb 6''': [[Physics 212, 2019: Lecture 7|Lecture 7]], Euler method for solving ordinary differential equations. Bacterial growth. Accuracy of algorithms.
 
:Scripts for this Module:
 
:Scripts for this Module:
 +
[[media:malthus.txt | Malthusian growth]] script, the simplest version.
  
 
;Module 3:
 
;Module 3:

Revision as of 10:06, 6 February 2019

Emory Logo

Back to the main Teaching page.

Back to Physics 212, 2019: Computational Modeling.

News

  • Welcome to the class!

About the class

Computation is one of the pillars of modern science, in addition to experiment and theory. In this course, various computational modeling methods will be introduced to study specific examples derived from physical, biological, chemical, and social systems. We will study how one makes a model, implements it in computer code, and learns from it. We will focus on modeling deterministic dynamics, dynamics with randomness, on comparison of mathematical models to data, and, at the end, on high performance computing. Students will learn Python programming language and will work on computational modeling projects in groups.

There are three goals that I have for students in the class:

  1. To learn to translate a descriptive formulation of a scientific problem into a mathematical / computational model.
  2. To learn how to solve such models using computers, and specifically using the Python programming language. This includes learning how to verify that the solution you produced is a correct solution.
  3. To learn basic algorithms used in computational science.

In addition, a minor goal of the class is to improve the students' ability to communicate their process of thinking and their results to others. To this extent, the class will require writing project reports, which will be graded on their clarity and completeness.

Logistics

  • Class Hours: M, W 10:00-11:15; MSC N 304
  • Labs: Thu or Fri 2:30-5:30; MSC N303
  • Office Hours
Professor: Ilya Nemenman -- Monday 11:30-1:00 (subject to change), and by appointment, MSC N240 or N117A if too many people.
TA: Qihan Liu -- Friday, 2:00-3:00, MSC N117E
TA: Jian Wang -- Wednesday, 2:00-3:00, MSC N118D
This tutorial is not a complete textbook. I will post additional lecture notes online as needed, or will direct you to additional chapters in other textbooks.
See also Computational Modeling and Visualization of Physical Systems with Python by J Wang and Computational Physics by Giordano and Nakanishi.
The bible of scientific computing is Numerical Recipies by Press et al.
  • At the end of each class where we do coding, please submit your work using a Coding Snippet assignment submission on Canvas.

Lecture Notes and Detailed Schedule

  • Class schedule is available in the syllabus.
  • Below I will post notes and scripts that we have written for the class. I will strive to post / update these notes before classes, but no promises.
Module 1
Jan 16: Lecture 1, Introduction, and beginning of Lecture 2, Introduction to the Modeling Process. Reading: Chapter 1 of the Python Student Guide. Intro to Python.
Labs 1, Jan 17-18: Chapter 1 of the Python Student Guide; installing Anaconda. Chapter 2 of the Python Student Guide.
Jan 23: Lecture 3, First steps in Python. Reading: Chapters 1 and 2 of the Python Student Guide.
Don't forget to submit your work at the end of the class using the Coding Snippet assignment on Canvas.
Labs 2, Jan 24-25: Chapters 1 and 2 in the Student Guide. Finish all of the exercises from the class -- make sure to pay attention to exceptions, like division by zero and roots of negative numbers. Then if time permits, move to Appendix B (Jupyter notebooks).
Scripts for this Module:
Jan 28: Lecture 4. First model, first code. Exceptions, initialization, and program verification. More Python constructions. Reading: Chapters 2 and 3 of the Python Student Guide.
Jan 30: Lecture 5. First numerical algorithms in Python: Newton method for solving algebraic equations. More Python constructions. Reading: Chapters 2, 3, 6.5 and Appendix B of the Python Student Guide.
Labs 3, Jan 31, Feb 1: Finish all of the exercises in Chapters 1-3 and Appendix B if you haven't done so yet. Finish the class exercises. Namely, strengthen your quadratic equation code to deal with exceptions. Then use the provided Newton method code to find all minima of the two functions requested in class. Strengthen the code to deal with various exceptions, such as divergence of the algorithm, inability to find minima, etc. You may want to write a wrapper around the code, which, in another loop, will explore finding the root from different initial conditions, and will then store the different roots that were found. Finally, use your new and improved Newton method code to find the resting position of the charge. Then start working on the projects provided for this module. We will discuss on Monday how to make the reports for them.
Feb 4: Lecture 6. Jupyter notebooks. Writing project reports. Introducing the projects. More Python. Quiz 1. Reading: Appendix B of the Python Student Guide.
Scripts for this Module
Miscellaneous Python scripts -- note that there's some bug in my homepage setup, and I cant upload the file with .py extension; it's been uploaded with .txt; rename it after downloading. This applies to all future downloads.
Solving a quadratic equation.
More miscellaneous scripts, including the Newton-Raphson code.
Jupyter notebook for solving the charges problem.
Sample project report in a Jupyter notebook for finding the equilibrium charge position problem.
Additional reading
Numerical Recipes book, Chapter 9, talks about finding roots of nonlinear functions, including the Newton-Raphson method and, in Section 9.6, the multidimensional version of it. Those interested, should read the general considerations in Section 9.0, and then whichever additional sections you find interesting.
Module 2
Feb 6: Lecture 7, Euler method for solving ordinary differential equations. Bacterial growth. Accuracy of algorithms.
Scripts for this Module:

Malthusian growth script, the simplest version.

Module 3
Scripts for this Module:
Module 4
Scripts for this Module:
Module 5
Scripts for this Module:

Projects

Available projects for each class module will be listed here about one class before you need to start working on them. If multiple projects are offered, you will need to choose the project for your group and email me for approval.

Class Module 1

Choose and do one of the projects. Note that you should write your own implementation of root finding, and do not use the fsolve function in Python. In all of these projects, you need to make sure that your report is written as I expect it to be, including verification that your code works in a correct way, and that you handle all the exceptions you could think of. This module is about root finding using the Newton-Raphson algorithm, so please use it in your solutions, rather than trying to invent something more complicated.

Project 1
(Physics) A cable supporting a suspension bridge has a catenary shape. To repaint the cable, a mechanized cart moves along it, whose engine can apply some maximum amount of force along the direction of the cable. Will the cart be able to come to the top of the cable? If not, where will it come to rest? Note that you may be able to solve this problem analytically, but here I am interested in a numerical solution -- you can use your analytical result to verify your numerics.
Project 2
(Biochemistry) A lot of enzymatic reactions in biological systems proceed according to the so-called Hill rate law, where the rate of conversion of a substrate chemical into a product is given by , where is the concentration of the substrate chemical, the constant is called the catalytic velocity, and is the Hill constant. Finally, is the Michaelis constant -- the concentration of the substrate, at which the conversion rate is half-maximal. A lot of biochemical processes in the cells are organized in so call futile cycles, where one enzyme converts the substrate into a product, and another immediately converts it back, so that the total number of the substrate and the product molecules is conserved. Such futile cycles are very useful to regulate the number of molecules of a certain chemical in a cell -- since molecules are constantly produced and degraded, one only needs to change either the rate of the forward production or the backward degradation a little, and the total number of product molecules will accumulate a large change over time. Imagine now that we have a system, where both the forward and the backward reactions are described by different Hill laws. Find the equilibrium concentration of the substrate and the product molecules.
Project 3
(More advanced; try at your own risk) We discussed the three fixed / one moving charges problem when all the charges were on a line. Now consider a situation where the charges are at arbitrary positions on the plane, but fixed to be within the plane. Find the equilibrium position of the moving charge. For this, you will need to extend the Newton-Raphson algorithm to find roots of a function with many arguments. This requires knowing multivariate calculus and linear algebra. Do not attempt the problem if you have not taken those classes.

Class Module 2

Class Module 3

Class Module 4

Class Module 5

Quizzes

Quiz 1
Quiz 2
Quiz 3
Quiz 4
Quiz 5