Physics 305: Computational Physics II

This page gives my homework advice and hints. You'll probably also want to check out the main course website.

Homework

You'll be submitting your homework to me via email at `wking (at) drexel (dot) edu`. To make sure it doesn't get lost in my inbox, you should add phys305 and homework 1 (or 2, or 3, etc.). Homework is due before class starts each Friday, so we will be able to discuss solutions in class.

Packaging

In order to practice good coding hygiene, you should package your submissions in gzipped tarballs, with the following auxilliary files:

README
A plain text file describing the purpose of your package, explaining how to install and use your package, and providing information for users to contact you.
Makefile
A list of instructions that tell the make how to compile your program.
COPYING
The license under which you distribute your code. There are many possible options. Choosing an explicit license for your code makes it easy for others to know if and how they are allowed to use your code in their own projects.

This is an common format for distributing software, and it will make people who need to compile and use your code (e.g. me) more comfortable. The benefit of such a format is that I can unpack, build, and run your package using something along the lines of

$ tar -xzf whatsit-1.0.tar.gz
$ cd whatsit-1.0
$ make run

without having to dig to deeply into the gory details of your submission. Of course, they may dig in anyway, but at least they'll have a standardized starting point.

I've put together an example homework submission (with extensive comments) which you can use as a template.

Graphs

All graphs and plots must have a title and properly labeled axes.

Useful tools

Version control

One tool that makes software development much easier is version control, even if you're the only one using your code. Version control lets you keep track of your history, so it is easy for you to decide if the version your foo project that you found on your laptop is more recent than the version you just discovered on the department server. If you've made well-commented commits, it will also tell you what you were thinking when you wrote a particular line of code, or fixed a particular bug.

Using a version control system is really easy with distributed version control systems like Git and Mercurial. For example, using Git can be as simple as:

$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
$ (edit files)
$ git commit -am 'Add contact information to README'

stackoverflow

When you have a coding problem, you are probably lucky enough that someone else has already come across that same problem and solved it. You can try and find those people using a general search engine, but you can also use stackoverflow, which is an excellent repository of questions, which usually have high quality answers like this one.