PHSX 567

Mathematical Physics II: Computational Physics

Spring 2024, MWF 2:10-3:00, Roberts 209

Instructor: Charles Kankelborg, Barnard 260C (x7853), kankel@montana.edu

Office hours: MW 4pm, F 3pm, or by appointment.

Course Website: http://solar.physics.montana.edu/kankel/ph567/

TA/Grader: Eric Davidson (ericdavidson at the usual MSU domain)

Text: Numerical Recipes, 2nd ed., Press et al. The text is freely available for download in PDF format from www.nrbook.com/a/. I will not often follow NR's order or presentation, but the text is a decent reference to most of the topics we will cover.

Programming Language: I developed the course in 2002 using C for the examples and assignments. In 2009, I switched to GNU Octave (http://www.gnu.org/software/octave/), which is open source software. Octave is nearly identical to MATLAB, a commercial product that is freely available to students and faculty. I have worked with a dozen or so programming languages in my career, from machine code in hexadecimal to high level interpreted languages. These days, I use Python and a little Julia. Once you've learned a couple of languages, picking up more of them is not hard.

Objectives: Computers make it possible to carry out calculations that would be impossible by hand. This course will be hands-on, practical and intuitive. By the end of the semester, you will gain experience solving several classes of problems that have no analytic solution, and will have useful tools to carry out moderately sophisticated data analysis. You will also discover the limitations of some common algorithms.

Learning Outcomes: Students will...

  1. Apply programming skills to diverse exercises in scientific modeling, data analysis, and visualization.
  2. Compute solutions to problems that cannot be solved analytically.
  3. Compare rates of algorithmic convergence.
  4. Analyze data to separate physically meaningful information from random error (noise).
  5. Devise and execute a term project that advances their educational and/or research interests.

Grading: approximately 50% regular assignments, 50% final project. There will be no exams. The final project includes a proposal (10 points), first draft (10), and final paper (50), as described below. Assigned work must be turned in by 11 pm local time on the due date, with caveats as noted below. If you have significant extenuating circumstances, please contact me.

Homework (10 points each) will be assigned approximately every 1-2 weeks. Most will be programming assignments, but some may involve analytical work with pencil and paper. Programming assignments, including all source code and output, both graphical and from the command line, should be conveyed to the grader via email. You may freely use standard libraries of code and cannibalize the example codes from class. For plots, images or other graphics, use a portable format such as JPEG, PNG, PDF, etc. You may use Matlab, GNU Octave, or Python for the assignments. Please provide enough information to the grader to easily run your code (language used, libraries, etc). If you prefer some other language, the grader may allow it at his or her sole discretion. A penalty (10% of possible points, with caveats noted below) will be assessed for late homework. Late homework will not be accepted after the Friday before finals.

The final project is an opportunity to attack a substantial (but tractable) computational physics problem. This could involve numerical simulation or data analysis. Talk to your advisor about selecting a suitable problem. You may use whatever programming language(s) and computational resources you have at your disposal. The work need not be original research. However, a problem relevant to your research would be ideal. I will be available to provide advice and guidance at any stage. Formulate a concise (about 3-4 pages) proposal and email it to me (not the grader) by midnight Wednesday, February 14, 2024. You will receive 10 points if it is turned in on time (1 point lost for every day late). Aim for a project that you can complete in about 8 weeks. The proposal should:

  1. Provide a concise, clear definition of the problem to be solved (4 points).
  2. Include appropriate citations to the literature (2 points).
  3. State your goals, enumerating a few milestones (steps) along the way to completion (2 points).
  4. Describe (as best you can at this point) the methods you intend to use (2 points).
You might think of this as a draft of the introduction and methods sections of your final paper. Bearing in mind that I am probably not an expert in your area of research, please make it very clear what sort of problem you are solving (system of ODEs, PDE, fitting data to a model, image deconvolution, digital filtering, etc.). Another way to say it is: why are you using a computer to solve this problem? I will provide feedback on your proposal. My goals are to maximize what you learn in the course of doing the project, and to help you succeed.

Your final paper on the project should be concise and informative, with a format similar to a journal article (an informative abstract, introduction, methods, results, conclusions, and references). \emph{Please turn in just the document, no source code or other data.} I recommend that you learn to use LaTeX (or whatever is commonly used in your field of research). If you use a word processor, be aware that equations sometimes turn into nonsense when transferred to a different computer that may not have the same fonts installed. Converting the final product to PDF should help. A first draft is due by email to me on Wednesday, April 10, 2024. It is in your best interest to be nearly finished with the project at this point. Howerver, turn in whatever you have, even if incomplete. You will receive 10 points if it is turned in on time (1 point lost for every day late). I will critique this draft to guide you in revising and completing it. You may turn in the first draft early if you like. I will read and respond with comments in the order I receive them. The final draft is due by email to me on May 3, 2024, the last day of class, by midnight in some time zone on Earth. I will grade them according to the rubric posted on the course website.

Topical Outline (subject to change)

It is not possible to cover the entire outline, but my notes are available on the website. Let me know if there is a topic of particular interest to you.

  1. Ch. 3, Interpolation
  2. Ch. 4, Numerical integration
  3. Ch. 12-13, Fast Fourier Transform
  4. Ch. 16, Ordinary Differential Equations
  5. Ch. 9, Roots of Nonlinear Algebraic Equations
  6. Ch. 10, Optimization (plus MCMC)
  7. Chs. 14-15, Computational Statistics
  8. Partial Differential Equations
  9. Inverse Problems

Resources

Numerical Analysis

The Numerical Recipes book and software is freely available online in several programming languages. If you like C++, then the third edition might interest you. Delve into the older editions for C, Fortran, etc. Several classic works on numerical methods are now available in Dover paperpacks. While not up-to-date, they are inexpensive and they cover at least some topics of interest. The dates I've listed below are original publication dates:

Programming

In addition to the online help available in both Octave and MATLAB, there is considerable documentation available on the web and in print.

If you are interested in higher performance computing, you may want to learn C. Consider starting with Steve Summit's online lecture notes, www.eskimo.com/~scs/cclass/cclass.html. You will need a good reference book, such as:

Some Relevant Applied Mathematics