- Theory.
- Find the file on you box which contains the declaration of the object
gsl_multiroot_function and read the declaration.
Hint: the file is gsl_multiroots.h;
- Practice.
- 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.
- Multidimentional root finding 'without derivatives': firing
projectiles at a target.
- Consider a cannon that fires cannonballs with muzzle velocity
v at angle θ from zenith and azimuth φ.
The coordinates of the projectile as function of elapsed time are given
as (check it)
| z(t)=v cos(θ) t - gt²/2,
|
| x(t)=v sin(θ) sin(φ) t,
|
| y(t)=v sin(θ) cos(φ) t.
|
- Suppose you want to hit a target with coordinates
[xtarget,
ytarget,
ztarget=0]
- Build a program that calculates the aiming angles to hit the target
using
gsl_multiroot_fsolver_hybrids algorithm.
- Make a plot which illustrates the progress of the algorithm.
- (optional) Compare with an algorithm with derivatives.
- (optional) Generalize to ztarget≠0.
- (optional) Add the wind-resistance drag force to the equation of motion of the
cannonball
in the form
Fdrag=-γvv,
where boldface denotes vectors, and γ is the wind-resistance parameter
of the cannonball.
- (optional) Add the atmospheric wind.