Computational Methods

Spring 2017
dr. H.J. Bulten

Description of the course and exam can be found in Lectures.pdf

The book edition 1 is available in electronic form here
Dependencies of the include files can be checked here

The lectures will take place in the computer class room at NIKHEF, room H2.39. The exercises need to be mailed before the deadline to henkjan@nikhef.nl. The exercise solutions will be discussed in the lecture following the deadline, so late submissions will not be graded.

A useful link is Wolfram: Wolfram

Codebase:
Cinclude.zip contains some include files and source files in C code; this is the edition 2 code. Cinclude.zip
include.zip contains the include files files in C++ code; this is the edition 3 code. include.zip

LECTURE NOTES:
Lecture 1, Feb 7 2017 : lecture1.pdf
Lecture 1b, Feb 7 2017 : (programming) lecture1comp.pdf
Lecture 2, Feb 9 2017 : lecture2.pdf
Lecture 3, Feb 14 2017 : lecture3.pdf
Lecture 4, Feb 16 2017 : lecture4.pdf
Lecture 5, Feb 21 2017 : lecture5a.pdf
Minimization, will be discussed Feb 23 2017 : lecture6.pdf
Lecture on Fourier analysis : Lecture 7, Feb 28 2017 : Fourier.pdf

Lecture on Wavelet analysis : Lecture 8, Mar 2 2017 : wavelet.pdf
Lecture on Ordinary Differential equations : Lecture 9, Mar 7 2017 : ODE.pdf
Lecture on Ordinary Differential equations : Lecture 10, Mar 9 2017 : ODE2.pdf
Lecture on Monte Carlo Techniques : MonteCarlo.pdf

Lecture on Matrix operations and Eigenfunctions: MatrixOP.pdf
Lecture on Schroedinger Equation Schroedinger.pdf


EXERCISES:
Your source code and results should be mailed before the deadline to henkjan@nikhef.nl. Details are specified in the exercises. Sometimes details relevant for the exercise are given during the lecture in which the exercise was posed. Please include your student number in the mail.

Exercise 1, Feb 7 2017 : exercise1.pdf
Exercise 2, Feb 7 2017 : exercise2.pdf
The data file for exercise 2 is here: data2.txt
Exercise 3, Feb 9 2017 : exercise3.pdf
Exercise 4, Feb 14 2017 : exercise4.pdf
Exercise 5, Feb 16 2017 : exercise5.pdf
Exercise 5 is due monday Feb 27. The full exercise is described in lecture 4. I expect you to work on it during the classes following lecture 5 and 6; probably you have questions.

Exercise 6, Feb 28 2017 : Exercise6.pdf
For Exercise 6, the data in time domain is given in this file: data6.txt
The files describing the square root of the PSD of the noise and the shape of the signal are given here : noise.h and signal.h.
The signal is calculated from the coalescence time backwards; you can calculate the amplitude X seconds before the coalescence time. Therefore, when you fill a vector with samples in time, you fill the vector at time T-x by calling signal(x).
Exercise 7, Mar 7 2017 : Exercise7.pdf
Exercise 8, Mar 16 2017 : Exercise8.pdf


LECTURE EXAMPLES:
Lecture 1: programming.
The C-code of the sine/cos example from lecture 1 is given here: myfunc.c speed.c and the include file myfunc.h
Exercise 2: an implementation of the code can be seen here cic.cpp

Fourier analysis: the function to smear and deconvolve the plot. The text output is read into root (root.cern.ch) to plot.
fourier.cpp

Ordinary Differential Equations: the spring on a pendulum example: string.cpp
This example generates an output file (pendulum.txt). The 3-d plot can be generated with root via a root session in which you type the following:
TNtuple *nt = new TNtuple("nt","","t:x:y:z:vx");
nt->ReadFile("./pendulum.txt");
nt->SetMarkerStyle(20);
gStyle->SetPalette(1);
nt->Draw("x:y:z:t");

Monte Carlo Examples: Gas kinetic theory, Maxwell-Boltzmann distribution: see lecture.
Random walk: mcex1.cpp

Center of gravity: mcex2.cpp

Schroedinger examples: Numerov shooting : numerov.cpp
Variational methods: base wave functions for square well: well.h well.cpp
And for harmonic oscillator (1d, 3d) : harmonic.h harmonic.cpp
The Mexican hat comparison:
mexican.cpp

Solutions Exercise 3: code and results: solutionEx3.pdf
ex3.cpp
Solutions Exercise 4: code and results: solutionEx4.pdf
ex4.cpp