def fmin_powell(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None, direc=None):
 opts = {'xtol': xtol, 'ftol': ftol, 'maxiter': maxiter, 'maxfev': maxfun, 'disp': disp, 'direc': direc, 'return_all': retall}
 res = _minimize_powell(func, x0, args, callback=callback, **opts)
 if full_output:
  retlist = (res['x'], res['fun'], res['direc'], res['nit'], res['nfev'], res['status'])
  if retall:
   retlist += (res['allvecs'],)
  return retlist
 elif retall:
  return (res['x'], res['allvecs'])
 else:
  return res['x']

def fmin_powell ( func , x0 , args = ( ) , xtol = 0.0001 , ftol = 0.0001 , maxiter = None , maxfun = None , full_output = 0 , disp = 1 , retall = 0 , callback = None , direc = None ) : opts = { 'xtol' : xtol , 'ftol' : ftol , 'maxiter' : maxiter , 'maxfev' : maxfun , 'disp' : disp , 'direc' : direc , 'return_all' : retall } res = _minimize_powell ( func , x0 , args , callback = callback , ** opts ) if full_output : retlist = ( res [ 'x' ] , res [ 'fun' ] , res [ 'direc' ] , res [ 'nit' ] , res [ 'nfev' ] , res [ 'status' ] ) if retall : retlist += ( res [ 'allvecs' ] , ) return retlist elif retall : return ( res [ 'x' ] , res [ 'allvecs' ] ) else : return res [ 'x' ]
minimize a function using modified powells method .