Ph 20/21/22: Guidelines and Ground Rules
Staff
- Lab Manager: Chris Mach (103-33, x2299,
chris{at}alice)
- Prof/Admin: Alan Weinstein, ajw{at}caltech{dot}edu
- Ph 20, 21 TA: Jacob Shen, xshen{at}caltech{dot}edu
- Ph 22, 21 TA: Chris Pattison, cpattiso{at}gmail{dot}com
The laboratory
- Physics 20, 21 and 22 - These are three terms (6 units each) of a computational
physics lab.
- Ph 20 is offered Fall, winter, spring terms. Nominally, CS 1 is a
pre-req.
- Ph 21 is offered in winter and spring. Nominally, Ph 20
is a pre-req for 21.
- Ph 22 is offered in the spring. Nominally, Ph 21 is a pre-req for
Ph 22.
- The course website with all the assignments and other resources:
http://www.pmaweb.caltech.edu/~physlab/.
- The purpose of Ph20/21/22 is for you to gain familiarity with the tools and techniques
of computational physics, both for simulating and solving simple physical
systems. The emphasis is on writing programs and using various tools to
solve physics problems.
-
The lab is not about how to program, but rather how to use computers
to solve problems in physics. Physics 20 requires completion of or
placement out of CS 1.
-
Chris Mach will set up Linux accounts and directories for all Ph20/21/22 students.
For this, he will need (a) full name, (b) e-mail address (where you
can be reached),
(c) requested login name (whatever you want, not case-sensitive), and
(d) initial password (case-sensitive), which you can change
with passwd. Do not use a password that you use anywhere
else! This is just for the physlab computing cluster.
- If you want access to the lab after 5 pm, you can get a key to the building
in 105 E. Bridge. The combination for the lock to the lab door can be
obtained from the TAs or Chris.
The assignments
- Each of the courses consists of several assignments
(eg, for Ph 20, there are 7).
- To pass the course,
you must turn in a passing version of all of them.
- Some assignments are shorter and are due the following week;
other are longer or harder, and are due two weeks later.
See the course website for due dates (which may be subject to change
as the term progresses!)
- If your TA is not satisfied
with your work, you will get your assignment back and have the opportunity to
revise it.
- Your TA is the final judge of what will earn you a passing grade
for a given assignment.
- All assignments (in pdf), as well as some useful additional
information, are posted on the ph20/21/22
website.
On the lab computers, you should run firefox
from your Linux account.
If you are using your laptop, you're welcome to use your favorite browser.
- Assignments tend to be cumulative (what you learn in
one assignment will be needed for future ones), and they will get increasingly
harder.
- Some parts of the assignments
(generally labeled with stars) are meant to be challenging, even for the best
students. You may leave them undone if you think that you have already spent a
reasonable amount of time working the rest of the assignment.
- You are strongly encouraged to maintain a
git repository
to maintain your code, your assignment writeups, and any other
relevant files.
- The TAs will explain what a git repo is, what it's for,
how to set one up, and how to use it.
There are many online tutorials, such as
this one on edureka!
- Assignments can be turned in by sending a link to your solutions in your git repo.
- Generally, you will turn in a brief written description
of your work, with explanatory graphs if requested; depending on the preference
of your TA, you should turn in a printout of your code, or make it available in
electronic form.
- You are very strongly encouraged to present your work using LaTeX.
If you don't know it, learn it! An easy way to get started
(and to collaborate) is
with overleaf.
- Learn how to embed your code, and your graphs and plots as
figures, into your LaTeX.
- You may work collaboratively in discussing the problem and the
general approach to the solution of the problem including relevant equations
and appropriate numerical techniques. However, you may not collaborate in the
writing of the code for solution of the problem: the actual computer program
for the solution of the problem must be your own.
-
The due dates for the assignments will be posted on
the website.
- Do not fall behind!
and keep in mind that the assignments typically get harder and longer
as the course progresses.
- Because it will be extremely difficult to catch up with
the assignments if you fall significantly behind, late assignments will
be accepted only with prior permission of your TA. Furthermore,
the maximum extension allowed will be one week after the due date,
except in extreme circumstances such as serious illness, etc.
Each student is generally allowed two one-week extensions during the quarter.
If multiple assignments are outstanding and a student is
significantly behind in the course, the student may be advised to drop
the course.
The sections
- There will be two or three three-hour formal lab sections each week, at the times
determined at the organizational meeting.
- For example, we may agree that these
will be on Tuesdays 1-4 pm and Fridays 1-4 pm.
- You must sign up for one of these,
and check in with the appropriate TA during that session.
- Please stick to one of these two days, and one of the TAs.
- The assignments often
require significant explanation, and the TAs will do that explaining during the
formal lab sessions.
- We require
that you show up for (a minimum of) one hour out of the three, to receive any handouts, read
any messages on the boards, hear what your TA has to say, and so on.
- The lab is
available at all times, but you are also welcome to use your own computer or
other facilities to complete the assignments.
- Even if you do so, you are still
required to check in at your section. Failure to attend the weekly lab session
may lead to our advising the student to drop the course.
Course material
- The class website includes links to the course
wiki.
The wiki is old and much
of it is obsolete, but there's still lots of good resources
there. We'll try to update and move it all to the web pages, so as
to not have two different places to go (and, no one remembers the
password for editing the wiki!).
- We will probably replace the outdated encryption assignment (Ph
20 Assignment 7) with one
that introduces you to signal processing (and there will be more of
that in Ph 21)
- A lot of the material in Ph 20-22 is kinda dated (this happens VERY
quickly in scientific computing!) You will likely find more modern
tools and techniques... good! Share with your TAs, who will try to
update the material as they go.
Computers & software
- You can use the physlab computer cluster, either by sitting in
front of a workstation and logging in with the username / password
supplied to you by Chris Mach, or by logging in remotely
with ssh <your-username>@tweedledee.caltech.edu.
But many of you will prefer to use your own computer.
- The easiest way to set up a python
environment in your personal computer is with
anaconda.
It even works on Windows!
The standard version is free. This is strongly recommended!
- If you have a Mac, with Xcode installed, you can do it other
ways; eg, MacPorts or just "pip install". Newbies will prefer
anaconda.
- Since python is a wonderfully "extensible" language,
there are (very) many useful packages
(numpy, scipy, matplotlib, astropy, scikit-learn, ...) that you will want to use.
- Anaconda serves as a
package manager, with a long list of
3rd-party packages
that it knows about.
- We will be using python 2.7, not the latest python 3.7. Take care -
managing different python environments is
notoriously problematic!
- Mathematica can be downloaded for Mac or Win10 (for free, site-wide
license) from software.caltech.edu
- Assignment 4 is about Unix. Your Mac has unix under the hood, so you
can do most or all of the assignment there. If you have Windows,
either (a) use the physlab cluster, or (b) install linux in a
virtual machine
(eg, VirtualBox).
(DON'T bother with cygwin, and you
probably don't want to bother with dual-booting). Google it!
- Stackoverflow is your friend!
- You are encouraged to earn how to use a git
repository,
and use it for your Ph20-22 work.
Setting up your laptop for Ph 20-22 work
- Here's some advice on setting
up your laptop for scientific computing. If you have other preferences,
please feel free to share with the class (or talk to us)!
- Mac (personal experience):
This website a good place to start from:
Setup a New Mac for Astronomy
- Python: Install
Anaconda
and conda update --all
- There are many good python editors available. For example,
"jupyter notebook" is good at telling stories, and "Spyder" is good at
organizing relatively long/complex code.
- Latex: Install MacTex for Latex and set up following
these guidelines.
Overleaf
is also a popular option, especially for collaborating on paper writing.
If you choose to use overleaf,
please make sure that you are equally comfortable with local latex
editors (e.g. MacTex), and understand how to compile files (useful for
writing papers).
- One way to start on latex is to play with a template.
Here is a very basic example:
hw0_template.tex. In order to see it,
you'll need to compile it with your latex editor (after installing a few
packages). There are plenty more templates online, and online
editor like overleaf.
- What to hand in?
- Latex file and figures. You can refer to this
example problem
(adapted from Ge/Ay 117, but our class won't accept handwritten
solutions). The point is to explain things clearly, and make
meaningful figures.
- Your code, in a file like name_hwX.py or a Jupyter
notebook name_hwX.ipynb.
- Linux: to remotely log into a linux machine from Mac's terminal, you
need to
install XQuartz & X11.
In addition, later in the term you might want to mount remote
directories onto your laptop using, for example, sshfx, Sftp or
rsync.
This makes it easier to transfer files around.
-
At some point, you might also want to Install Xcode (from Apple
Store), edit your ".bash_profile" (to set up alias, change color),
personalize you favorite text editors, and so on.
- If you have a Linux system laptop, you
just need to install Anaconda. Most of the other tools should be
already there :)
- Windows?
The Ph 20/21/22 staff don't have much experience with it
as a platform for scientific computing.
Anaconda is available for
Windows, and may provide a sufficiently workable computing environment.
Mathematica for Windows presumably works fine.
But you may find it better to just remotely log in
to the ph20 lab's linux machines.
Recent versions of Win10 include an ssh client, which may need to be
enabled.
Else, you can download, install, and run
PuTTY, which should work fine.
Please practice remote login and play with it as early as possible,
and let us know if anything is unclear!
Return to the Physics
Computation Lab page.