- Theory.
- Practice.
- Numerical integration with Gauss-Kronrod algorithm.
- Look up the definition of the error functions erf and
erfc in Wikipedia.
- Make a subroutine that calculates the error function
erf by direct numerical integration.
- Make a plot where you compare you subroutine with the
erf function from math.h .
- When |x|<2 use erf and
gsl_integration_qags, otherwise use erfc and
gsl_integration_qagil
gsl_integration_qagiu for negative and positive x
correspondingly.
- Multidimensional minimization with Nelder-Mead algorithm
(
gsl_multimin_fminimizer_nmsimplex2rand).
- Suppose that an experiment on measuring the activity
of a radioactive substance as function of time gives
the following result
| time ti
| activity yi |
| 0 | 6.76804 |
| 1.11111 | 5.66591 |
| 2.22222 | 5.04163 |
| 3.33333 | 4.55816 |
| 4.44444 | 4.24362 |
| 5.55556 | 3.86711 |
| 6.66667 | 3.73269 |
| 7.77778 | 3.70706 |
| 8.88889 | 3.53118 |
| 10 | 3.53251 |
where the time ti and the activity yi
is given in some rescaled units.
- I hate to say it, but we shall disregard the
experimental errors for this problem.
- Fit the function f(t)=A*exp(-λt)+B (where
A,
λ, and
B
are fitting parameters) to the data and determine the
half-life of the substance.
- You should solve the problem by doing the multidimensional
minimization using the
gsl_multimin_fminimizer_nmsimplex2rand
algorithm.
- The function to minimize is
F(A,λ,B)=∑i
(f(ti)-yi)², that is, you have got a three-dimensional
minimization problem in the space of the parameters A,
λ, and
B.
- Plot the experimental data and the fitting function.