Part II Computaonal Physics Exercises
David Buscher v. – //
Contents
Introducon
Assessment
. Pigeonholes ………………………….. . Codequality…………………………..
Geng started
. UsingtheLinuxMCS……………………… . Sengupyourscipyenvironment ………………. . Sengupyourworkspace…………………… . Runningyourprogram …………………….. . Plongyourresults………………………. . Examplecode ………………………….
Exercise : Integraon
. Goal………………………………. . BackgroundTheory………………………. . Tasks ……………………………… . Stepbystepguide:Monte-Carlointegraon . . . . . . . . . . . . . . Step by step guide: Numerical Integraon with . . . . . . . .
Exercise : The Driven Pendulum
. Goal……………………………….
. Physics…………………………….. . Tasks ……………………………… . Hints ………………………………
Exercise A: Helmholtz Coils
. Goal………………………………. . Physics…………………………….. . Tasks ……………………………… . Hints ………………………………
Exercise B: Diffracon by the FFT
. Goal………………………………. . Physics…………………………….. . Tasks ……………………………… . Hints ………………………………
Introducon
These exercises are designed to help you learn some , understand some physics and learn a lile more about numerical programming. You should aempt the exercises one per week, in the order given. Demonstrators will be on hand in the MCS to assist.
The speed at which people can program varies widely. It even varies for individuals day by day — all programmers will sympathise with how much me can be wasted trying to fix an obscure bug. So do keep an eye on the clock, and do seek assistance. Talk to your colleagues so you can share experience and spot each others’ mistakes. The goal of the exercises is for you to learn – and you can only do this by experience.
Each exercise is split into tasks. The core task or tasks are ones that I hope you will all be able to achieve in the class in the me available. If you hand in a working soluon to this you will get approximately –% of the credit for the exercise. There is also one or more supplementary tasks per exercise, which take the problem further, or in a different direcon. I hope that many of you will achieve some or most of these, and they count for the remaining fracon of the credit.
I have given structured hints to each problem. In addion, you should browse the code examples available on the MCS computers (see §.), and, importantly consult the relevant documentaon for the libraries such as and — finding and learning from online documentaon and code examples is an important skill. There are some starng links from the course web-page or just use a search engine.
Assessment
Over the weeks you should carry out three exercises: Exercise , Exercise , and either Exercise A or B. The marks available are a maximum of for exercises and , and a maximum of for exercise A or B, for a total of marks.
You should upload your soluon to the exercises to your pigeonhole (see below). The deadline is posted on the course web site and the TiS. You are encouraged to submit your work as soon as it is in a reasonable state, and move on. So don’t spend too much me on the tasks, but don’t spend too lile me either.
The exercises suggest what to submit: normally this is
. Source code file: normally this will be just one or two files (or files). Python files should run without problem on the MCS using ). If using , your files should compile and link on the MCS system (I will assume that the files require the Gnu Science Library ( ) and and libraries to link).
. a text file which describes very briefly what you did, any major problems, and menons any numerical answers required and describes any accompanying plots. An alternave is to submit a PDF file, called which contains the text menoned above, but can also include the plots men- oned below. Do not submit Microso Word files or similar — only plain text or PDF files will be considered.
. PDF plots illustrang the problem. See §. on how to plot in PDF format. Your plots can be included in the file if desired, in which case addional plot files are not required. Remember to annotate your graph axes appropriately.
Please be aware of the following:
• You must submit Python files and not files (Jupyter notebook files). The Jupyter notebook is a good environment for experimenng with Python, but for this course, you must submit your work as a standard Python program.
• Please do not submit data files or C executables to the pigeonholes. Any files (with the excepon of PDF files) larger than MB will be deleted without looking at them.
. Pigeonholes
You are required to submit your work electronically to what I have called your pi- geonhole. You should upload your answer to each exercise to its own directory. These directories should have the names