# Numerical Methods

by Rasmus Handberg

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.

Directory
Input:
makefile
hello.f95
Output:
hello
out.txt

## QR-decomposition

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

Directory
Input:
makefile
main.f95
matrix.f95
Output:
main
out.txt

## 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.

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

## Interpolation

Interpolate a tabulated function (xi,yi) using a polynomial and quadratic spline interpolation.

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.

## Ordinary differential equations

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

Directory
Input:
makefile
main.f95
integrate.f95
Output:
main
out.txt

## Monte Carlo integration

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

Directory
Input:
makefile
main.f95
montecarlo.f95
Output:
main
out.txt

## 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.

## Project: Fast Fourier Transformation in astrophysics

The project can be found here:

Project

Some of the figures produced:

To understand what these show, read the project.