Things affecting the evaluation of the work include: clarity of the solution, dividing the task into proper procedures, readability (variable names, comments, etc.), generality, self-explanatory output, ease of use.
Code fragments copied (possibly with modifications) from elsewhere must be clearly indicated both in the program code and document.
If a user defined function is given as a parameter to e.g. an integration routine, use several functions for testing. Again, some cases must allow an analytical solution for checking.
Help can be asked any time, but please be patient; I may not have time to answer immediately.
Personal consultation is available mainly at Tuorla. See our contact information.
Return the work by the end of January If more time is needed, contact me in advance.
Be prepared for as many error situations as possible. The calling program must be informed on the errors.
Coefficients are read from a file, but the program can also generate random data for testing.
Study how the execution time depends on the number of equations (must be pretty big to show the differences).
In addition to the coefficients the procedures must return their errors, average residual of the data points and the maximum deviation from the function fitted.
Be prepared for as many error situations as possible. The calling program must be informed on the errors.
Use some graphics library or a separate program to display the results.
Be prepared for as many error situations as possible. The calling program must be informed on the errors.
Test the module with several different wquations. Investigate the accuracy if the methods and the dependence on the order of the method, step length, and the total length of the interval.
Initial values needed by multistep methods are first calculated using a single step method. Apply the methods to the linear harmonic oscillator and compare the results to the exact solution.
Test the module with several different wquations. Investigate the accuracy if the methods and the dependence on the order of the method, step length, and the total length of the interval.
Initial values needed by multistep methods are first calculated using a single step method. Apply the methods to the linear harmonic oscillator and compare the results to the exact solution.
The first Legendre polynomials are
P0(x) = 1,
P1(x) = x,
P2(x) =
(1/2) (3x2-1),
P3(x) =
(1/2) (5x2-3x),
P4(x) =
(1/8) (35x4-30x2+3).
Legendre polynomials can be evaluated using the recurrence relations
P0(x) = 1,
P1(x) = x,
(2n+1)xPn(x) =
(n+1)Pn+1(x) +
nPn-1(x).
The points needed for the Gaussian quadrature are zeros of the Legendre polynomials.
A lot of additional information can be found in e.g.
Arfken: Mathematical methods for physicists, Academic Press,
Abramowitz, Stegun: Handbook of mathematical functions, Dover.
Be prepared for as many error situations as possible. The calling program must be informed on the errors.
Test the functions using many different values. Investigate the accuracy and its dependence on the arguments. Find the renge where the functions can be safely used.
The elliptic integrals of the first kind are defined as
F(x | m) = \int0x [(1-t2) (1-mt2)]-1/2 d t, 0 <= m < 1,
and the integrals of the second kind as
E(x | m) = \int0x [ (1-mt2) / (1-t2) ]1/2 d t, 0 <= m <= 1.
The Bessel function Jk(x) is
Jk(x) = (1 / 2\pi) \int02\pi cos(kt - x sin t) d t.
The Bessel functions can also be evaluated from the series expansions
J0(x) = 1-(x/2)2 + (1/4) (x/2)4 - ... + [(-1)n / n!]2 (x/2)2n + ...
Jk(x) =
(x/2)k (1/k !) [
1 - (1 / k+1) ((x/2)2 + ... +
((-1)n / n !)
(k+1)(k+2) ... (k+n)
(x/2)2n
+ ... ].
Approximate formulas for the first Bessel functions are
J0(x) =
1 - x2/4 + x4/64 +
O(x6),
J1(x) =
x/2 - x3/16 +
O(x5),
J2(x) =
x2/8 - x4/96 +
O(x6),
J3(x) =
x3/48 + O(x5),
J4(x) =
x4/384 + O(x6).
A lot of additional information can be found in e.g.
Arfken: Mathematical methods for physicists, Academic Press,
Abramowitz, Stegun: Handbook of mathematical functions, Dover.
Be prepared for as many error situations as possible. The calling program must be informed on the errors.
Test the functions using many different values. Investigate the accuracy and its dependence on the arguments. Find the renge where the functions can be safely used.
The Chebychev polynomial Tn is defined as
Tn(x) = cos n \phi = cos(n arccos x).
T0(x) = cos 0 = 1,
T1(x) = cos arccos x = x,
T2(x) = cos (2 arccos x) = cos 2\phi
= 2 cos2 \phi - 1
= 2 x2 - 1,
T3(x) = 4x3 - 3x,
T4(x) = 8x4 - 8x2 + 1
T5(x) = 16x5 - 20x3 +
5x.
Since the zeros of cos \phi are \phi=(2k+1)\pi/2, k=0,1,..., the zeros of the function cos n\phi are
\phi = ((2k + 1) / n) (\pi / 2), k=0, 1, ...
Since Tn(x)=cos n phi, these are also the zeros of the polynomial Tn. In terms of x the zeros are
xk = cos [ ((2kk+1)/n) (\pi/2)], k=0, 1, ... , n-1.
A lot of additional information can be found in e.g.
Arfken: Mathematical methods for physicists, Academic Press,
Abramowitz, Stegun: Handbook of mathematical functions, Dover.
Allowed parameter ranges can be constrained by a penalty function that yields very high values outside the allowed region.
Autocorrelation function
Dependence of the values separated by k time steps is described by the autocorrelation
R(k) = (1 / (N-k-1)) \sumi=1N-k fi fi+k,
whereN is the number of points. When this is evaluated for different values of the delay k, k=1, ..., N-2, the autocorrelation function is obtained.
Multiples of the actual period are always visible in the autocorrelation function.
In case of pure white noise successive values are not correlated at all. If there is continuous temporal variation, successive values are close to each others and the strongest correlation is found between adjacent (k=1) points. High correlations at small values of k are not due to periodicity. Only the next local maximum is an indication of the periodic nature of the series.
Structure function
Consider the difference x(t+\tau)-x(t). The first structure function is
D(\tau) = (1/N) \sum [ x(t+\tau) - x(t]2.
This is well defined even when the mean value and variance are not. Thus structure functions can be applied to more general time series than autocorrelation functions.
The following distributions must be included
The density function of the normal distribution is
f(x) = 1 / (\sqrt(2\pi)\sigma) exp( -(x-\mu)2 / \sigma2),
where \mu is expectation and \sigma2 variance.
The cumulative probability function of the normal distribution
P(x) = (1 / \sqrt(2\pi)) \int-\inftyx exp( - t2 / 2) d t
cannot be calculated analytically. However, several approximate expressions can be derived. The cumulative probability function of the (0, 1) normal distribution is approximately
P(x) = 1 - exp( -x2/2 / \sqrt(2\pi)) (0.4361836t-0.1201676t2+0.9372980t3),
where t=1/(1+0.33267x).
(Abramowitz, Stegun: Handbook of mathematical functions, Dover)
d x/d t = a(y-x)
d y/d t = -xz+bz-y
d z/d t = xy-cz,
where a=10, b=28 ja c=8/3.
Select a suitable starting point, and draw x (or y) as a function of time. In the same picture, draw several curves using slightly different initial values.
Draw a diagram showing how y behaves as a function of x. Study how this curve changes when the constants a, b and c are changed.