I added a metropolis algorithm, the code is not tested yet, the syntax needs te be checked, trial number 2