using Powell's method