nelmin searchs for a minimum of a function. In each iteration step the function is evaluated at a simplex consisting of p+1 points. The simplex contracts until the variance of the evaluated function values is less than eps (or the maximal number of iterations is reached).