Computer science

This page contains various programs, algorithms and data structures that I have made in connection with numerical mathematics, linear algebra, computation theory and other various topics.

Robotics

Picking a uniformly distributed random direction in 3D space

Choosing a random direction, uniformly distributed on a sphere in 3D-space is essential to many algorithms in robotics. This Mathematica notebook shows the naive/incorrect approach and a simple correct approach based upon Gaussian distributions.

dist2.nb

Linear Algebra

Basale lineær algebra i Mathematica
Et par enkle eksempler på hvordan matrixoperationer fungerer i Mathematica. Blev lavet i forbindelse med en skriftlig eksamen i lineær algebra.

MM02 notebook

Numerical Algorithms

Cholesky Factorization
Mathematica function for performing Cholesky factorization of a skew-symmetric matrix. A good example of how to compile a Mathematica function for faster execution.

choleskyfact.nb
Gradient in two variables
gradient2vars.nb
Richardson extrapolation and error estimation
Functions for performing Richardson extrapolation. Useful for speeding up most numerical algorithms and estimating the numerical error.

richard.nb
Secant-method
This is the classical secant-method of finding the root of a function.

secantfindroot.nb
Steepest Descent Min/Max-value solver
Steepest descent method using the gradient to find the maximum or minimum value of a function. Dependant on the secant method and gradient found above.

steepestdescent.nb

Network communications

Simple threaded webserver in Java
A small and simple webserver written in Java. Listens for incoming connections on port 1300 and spawn new threads for serving the HTTP contents.

WebServer.java
HttpRequest.java
Test of a basic stop-and-wait link-layer protocol


This is a basic example of a stop-and-wait protocol using postive and negative acknowledgements to get reliable link-layer data transfer. The source was intended as a test on a PC before moving on to development on a AM186ER microcontroller.

ndl.h
ndl.c

Operating Systems

Basic test of classic forking on Linux
A very simple test of multiple threads, accessing the same variable with the problems it gives.

forking.c
Test of POSIX threading, semaphores using commandline interpreter
This is an interactive test of acquiring/releasing semaphores in a multithreaded environment. The user can acquire/release semaphored variables through an interactive interpreter.

semaphoring.c