inside simplex function