fortran implementation for thesis problems