# Numerical Methods

This is my solutions to the exercises in the course "Numerical Methods" in the spring 2008. All programs are written in Fortran 95.

## Hello World

Writes "Hello World" on the screen.

## QR-decomposition

Solve system of linear equations, calculate determinant and inverse of a matrix.

## Matrix diagonalization

Diagonalise a matrix, to find it's eigenvalues.

Please note that the file matrix.f95 has been changed slightly from the last exercise.

## Least Squares Fit

Performs a Linear Least Squares Fit to a given set of datapoints.

Please note that the file matrix.f95 once again has been changed slightly from the last exercise.

main.f95

leastsqrfit.f95

matrix.f95

fit1.gnuplot

fit2.gnuplot

out.txt

fit1.png

fit2.png

The program produces the following plots, showing both a linear fit and a parabola fit:

## Interpolation

Interpolate a tabulated function (x_{i},y_{i}) using a polynomial and quadratic spline interpolation.

main.f95

interp.f95

pointerp.gnuplot

out.txt

points.dat

pointerp.dat

qspline.dat

interpolation.png

The program produces the following plot, showing both a polynomial and quadratic spline-interpolation:

## RootFinding and Optimization

Find roots of a system of non-linear equations using the modified Newton method. Minimize a function in n variables using the downhill simplex algorithm.

main.f95

kind_defs.f95

roots.f95

simplex.f95

matrix.f95

out.txt

## Ordinary differential equations

Solve a system of ordinary differential equations using an adaptive-step-size Runge-Kutta routine and using the Prediction-Correction method.

## Numerical Integration

Numerical integration with adaptive quadratures and reuse of points.

## Monte Carlo integration

Numerical Monte Carlo integration with pseudo-random, quasi-random and stratified sampling.

## Fast Fourier Transformation

Implementation of a Fast Fourier Transformation (FFT) which applies the Danielson-Lanczos lemma recursively. The FFT is then used to calculate amplitude-spectra and do simple filtering.

main.f95

fft.f95

kind_defs.f95

spectrum.gnuplot

filter.gnuplot

Data/simpel_short.dat

out.txt

plot1.png

plot2.png

## Project: Fast Fourier Transformation in astrophysics

The project can be found here:

kind_defs.f95

fft.f95

image.f95

spectra.f95

speedtest.f95

m92.f95

out_crabnebula.txt

plot1.eps

speed.eps

psf_surf.png

M92.png

PSFCorrected.png