readme: add exercise 4 and 5

This commit is contained in:
Giù Marcer 2020-04-30 22:28:27 +02:00 committed by rnhmjoj
parent 5a5cd927e3
commit 3920539a3a

View File

@ -34,15 +34,15 @@ libraries to build:
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
(build-time only)
Additionally Python (version 3) with `numpy` and `matplotlib` is required to
Additionally, Python (version 3) with `numpy` and `matplotlib` is required to
generate plots.
For convenience a `shell.nix` file is provided to set up the build environment.
For convenience, a `shell.nix` file is provided to set up the build environment.
See this [guide](https://nixos.org/nix/manual/#chap-quick-start) if you have
never used Nix before. Running `nix-shell` in the top-level will drop you into
the development shell.
Once ready, invoke `make` with the program you wishes to build. For example
Once ready, invoke `make` with the program you wish to build. For example
$ make ex-1/bin/main
@ -115,6 +115,30 @@ Note: the histogram parameters affect the computation of the χ² and the
relative parameter estimation.
### Exercise 4
`ex-4/bin/main` generates a sample of particles with random oriented momentum
and creates an histogram with average vertical component, in modulus, versus
horizontal component. It is possible to set the maximum momentum with the
option `-p`. A χ² fit and a t-test compatibility are performed with respect
to the expected distribution and results are printed.
To plot a histogram of the generated sample do
$ ex-4/bin/main -o | ex-4/plot.py
It is possible to set the number of particles and bins with the options `-n`
and `-b`.
### Exercise 5
`ex-5/main` compute the integral of exp(1) between 0 and 1 with the methods
plain MC, MISER and VEGAS. Being reiterative routines, it takes the number of
iterations as its only argument.
It prints out the obatined value and its estimated error for each method.
### Exercise 6
`ex-6/bin/main` simulates a Fraunhöfer diffraction experiment. The program
@ -122,13 +146,13 @@ prints to `stdout` the bin counts of the intensity as a function of the
diffraction angle. To plot a histogram simply pipe the output to the
program `ex-6/plot.py`.
The program convolves the original signal with a gaussian kernel (`-s` to
The program convolves the original signal with a Gaussian kernel (`-s` to
change the σ), optionally adds a Poisson noise (`-m` to change the mean μ) and
performs either a naive deconvolution by a FFT (`-m fft` mode) or applying the
Richard-Lucy deconvolution algorithm (`-m rl` mode), which is expected to
perform optimally in this case.
The `-c` and `-d` options controls whether the convolved or deconvolved
The `-c` and `-d` options control whether the convolved or deconvolved
histogram counts should be printed to `stdout`. For more options
run the program with `-h` to see the usage screen.