COURSE TIME:
Tuesdays 3:10 - 4:00 pm
COURSE LOCATION: Wellman 6
INSTRUCTOR:
Richard Scalettar
TEACHING ASSISTANT:
Blaine Bush
PROBLEM SESSIONS:
Physics 106; Tuesdays 4:00-5:30 pm
GRADING:
|
In this course you may use emacs or vi or any editor of your choice. However programs must be written in C or C++. |
TEXT:
None
In practice, we have found that not everyone is familiar with this
material, so the course begins with an "Assignment 0'' which involves
logging into the computer and entering, compiling, and running some very
simple programs. We provide tutorials on the linux operating system
used in the Physics Department computer lab, for those who will do their
work there.
After Assignment 0, we will continue with simple programs motivated by
standard calculus problems (root finding by Newton's method, numerical
integration). Next comes a topic for which the programming is still
very easy, but the concepts and results are much less familiar: chaos.
The heart of the course will be "molecular dynamics" programs for the
damped, driven oscillator and the Kepler problem. We will make contact
with analytic solutions developed in Physics 105AB and also show how the
method can do analytically intractable problems (anharmonic potentials,
three body problems). We will finish by discussing the numerical
solution of the diffusion equation.
Problem Set Topics
Very Simple C Programs to look at (C++ versions below, courtesy of
Vlad Iglovikov):
Very Simple C++ Programs to look at, courtesy of
Vlad Iglovikov, C versions above:
Problem Sets
Student Work
Background Material
Some programming tasks you could try for fun.
Diagonalization Routines
SYLLABUS:
The goal of this course is to familiarize you with the basic tools
required for using a computer to do physics problems and some of the
concepts used in numerical simulations. We cannot attempt a formal
presentation in this one unit course, so we will learn the material
through applying
these tools and concepts to some specific problems.
There are many possible languages (mathematica, python, matlab ...)
that we could use towards this goal, and different instructors
make different choices.
Our selection here will be to use 'C' (or C++).
This is mostly because it is a very powerful, widely-used, and therefore
useful language, but also because, in principle, a
prerequisite for this course is ECS 30, which covers both an
introduction to using a computer (the linux operating system)
and to C programming.
(ECS 30 Link)
0. Intro to Computer Lab (linux, editor) and two simple C programs.
1. Newton's method for root finding.
2. Numerical integration with trapezoidal rule.
3. Chaos and the logistic map.
4. Molecular Dynamics for the harmonic oscillator.
5. Molecular Dynamics for the harmonic oscillator: driving and
damping.
6. Molecular Dynamics for the Kepler problem.
7. One dimensional diffusion equation.
Your zeroth problem set (see below) involves typing any four of the
programs below into the computer, compiling and running. If you would like
further practice, try some additional ones.
VERY IMPORTANT!!!!
I strongly encourage you *not* to cut and paste the programs in.
Type them yourself. This forces you to focus on the language, but
also gives you the opportunity to type things in incorrectly.
Paradoxically, this is a *good* thing, because you will begin
to get experience in error messages and debugging. It's much better to
start this process out with simple codes like these than
with the more complex ones which come later.
So, again, do not cut and paste the codes.
Adding two numbers (in C)
Counting even integers (in C)
Counting even integers with output to file
(in C)
Generating Fibonacci numbers (in C)
Summing arithmetic series (in C)
Summing geometric series (in C)
Taylor series for exp (in C)
Taylor series for sine (in C)
Finding intersection point of two lines (in
C).
do-while loop (in C)
Random numbers and their moments (in C)
Your zeroth problem set (see below) involves typing any four of the
programs below into the computer, compiling and running. If you would like
further practice, try some additional ones.
VERY IMPORTANT!!!!
I strongly encourage you *not* to cut and paste the programs in.
Type them yourself. This forces you to focus on the language, but
also gives you the opportunity to type things in incorrectly.
Paradoxically, this is a *good* thing, because you will begin
to get experience in error messages and debugging. It's much better to
start this process out with simple codes like these than
with the more complex ones which come later.
So, again, do not cut and paste the codes.
Adding two numbers (in C++)
Counting even integers (in C++)
Counting even integers with output
to file (in C++)
Generating Fibonacci numbers (in C++)
Summing arithmetic series (in C++)
Summing geometric series (in C++)
Taylor series for exp (in C++)
Taylor series for sine (in C++)
Finding intersection point of two
lines (in C++) .
do-while loop (in C++)
Random numbers and their
moments(in C++)
Assignment 0
Assignment 1
Assignment 2
Assignment 3
Assignment 4
Assignment 5
Assignment 6
Assignment 7
Assignment 8
Wesley Hu's animation of diffusive spreading (Assignment 7, problem 1).
Wesley Hu's animation of temperature equilibration (Assignment 7, problem 2).
The vi editor
The linux operating system
Introduction to xmgrace
Collatz Conjecture
The Locker Problem
Instructions for compilation and use.
jacobi.c
jacobi_test.c
nrutil.c
nrutil.h
input.txt