Dr Peter Boyle, 2007.
The idea that physics is about solving equations analytically is a major
misapprehension in undergraduate education created by teaching you the
things we can solve instead of the
things we can't.
The mathematics underlying most problems of interest today (e.g. most
non-linear
systems) cannot be solved analytically, and the contribution of
computing in 20th century physics has been to solve otherwise intractable
equations by using numerical algorithms to integrate the nonlinear force in a
simulated time,
just as nature integrates its complex forces in real time.
In the 21st century, computer simulation will leave complete mathematical
solution
further behind and physical phenomena will be deemed understood when numerical
simulation of the governing equations of motion for the underlying processes
are shown to describe the
real world.
See the background section for more
detail of the numerical algorithms used in this course.
This course aims to give you a background in the essential skills underlying
21st century physics.
Hopefully, you will both acquire some object oriented programming skills and
learn some
good programming habits in the process.
During this course you will:
The programming language used in this course is exclusively Java.
While Java is not the scientific programming language of choice (C++
is faster and more powerful, and Fortran is a slowly dying but still common
dark art),
Java is cross-platform portable, reasonably object-oriented, eliminates
some of the warts of C++, and is very common in the "real"
world and thus a transferrable skill.
While it is intended that you use the CPLab Linux cluster you should be able
to equally well use java tools on your own, or any other, computer. I have
avoided relying on any physics department specific packages, and, with a
standard J2SE JDK install from java.sun.com, you should be able to run all the
code in this course on your own computer.
The required programming tools are all available in the Computational Physics
Laboratory and your own computer is not required.
A reference summary of the programming environment is CPLab
Java Reference
The material of this course is designed to be accessible anywhere on the
Edinburgh University campus, through a World Wide Web interface. This page is
accessible at https://www2.ph.ed.ac.uk/~paboyle/Teaching/CompMeth/index.html
Prior to taking this course you must have a basic knowledge of the
Java programming language, and the Unix/Linux environment in the CPLab.
This background would typically have been obtained in the Physics 2
SciProg course. If you have not taken this course you should
contact Dr Boyle to discuss your
programming background.
If you have passed the Computer Simulation 2h half course then you should
sign up to the more advanced Computer Simulation course instead of the
Computational Methods course.
You should refresh your memory of with the Physics 2
Scientific Programming course and associated
documents.
Particular attention should be payed to
· Loops
· Methods
· Objects
Some useful Java documentation (increasingly advanced).
This is a continuously assessed course, so you will be marked in the lab by
demonstrators on your own work. You are
responsible for ensuring you get your checkpoints marked by asking
demonstrators to do so.
In happier times, hacking, meant
taking existing high quality example code and modify it to rapidly solve a
different problem.
Being able to both decide on the best example to copy (there is a lot of code on the web, and effective use of the web
really is
an important skill both in programming and even for research) and then use it
cleanly and effectively is one of the skills we hope you acquire.
Bear in mind that Google really is a programmers best friend.
For example try google:
"java string integer conversion"
It is perfectly acceptable to find and modify useful example code with google (providing they are not specifically solutions from other
Students to this particular course). This is the way real programmers operate on a daily basis.
However simply copying someone else's working code is not conducive to
either acquiring these skills nor acquiring a good mark.
In this spirit we will provide you with starting points that solve similar
but different problems, as examples of good and well
documented code using the necessary constructs.
The course is taught on-line in the CPLab with a series of computer examples
and assessed checkpoints. If you fail
to make a checkpoint, there is a "catch up" mechanism where we make
example solutions available for each checkpoint (with a reduced
mark for that checkpoint).
It is expected that you will need to spend more time on the course than the
lab sessions alone.
There are six checkpoints in all. It is mandatory that all students will
complete checkpoints 1-5, while at least an attempt checkpoint
six is required to ensure the best marks.
Some of the marks in each checkpoint are labeled Advanced. These are worth around 25% of the marks and are
harder than the standard section. A perfectly good pass should be obtained
without doing any advanced sections, but the best marks will be obtained by
putting in the additional effort.
Checkpoint one is worth ten marks and Checkpoints 2-6 are each worth twenty
marks
The marking scheme is available here.
The following are the rules of the lab:
Please feel free to help each other in the lab, or use websearches, but
avoid cut/paste and copying entire files.
When help has been obtained from either a friend, or a websearch,
acknowledge that help with a
comment inserted in the code. Help for simply debugging or
checking/fixing syntax is very much encouraged,
and while there will be no effect on your marking, the acknowledgement
may help increase the mark of the person who helped
you.
If help involves actually copying sections of code, however, this may reduce
that portion of your mark, so this
should be minimised to obtain the best marks.
Anyone caught plagiarising without
acknowledgement will fail the course.
Model solutions to each checkpoint will be made
available online after the deadline has passed.
If you have been unable to write a working program by the deadline, you may
obtain up to half marks by understanding and running the
model solution as directed by the checkpoint to obtain plots, fully commenting
the code with your own comments, and presenting it to the demonstrator having
told the demonstrator you took the model solution. Your demonstrator will then as usual ask you some
questions to assess your understanding of the code and problem and give you a
mark.
You may also elect to present a classmates code in
a similar fashion (acknowledged as above). The demonstrator
will assess your understanding of how the code works, and may require you to
make small adjustments to show your understanding.
Disclosing this may help improve the mark of the person you received help from.