implemented griewangk function