title: How do I use a minimization function in scipy with constraints
body: <p>I need some help regarding optimisation functions in python(scipy)
  the problem is optimizing <code>f(x)</code> where <code>x=[a,b,c...n]</code>. the constraints are that values of a,b etc should be between 0 and 1, and <code>sum(x)==1</code>. The scipy.optimise.minimize function seems best as it requires no differential. How do I pass the arguments? </p>
  
  <p>Creating an ndarray using permutation is too long. My present code as below:-</p>
  
  <pre><code>import itertools as iter
  all=iter.permutations([0.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0],6) if sum==1
  all_legal=[]
  for i in all:
  if np.sum(i)==1:
      #print np.sum(i)
      all_legal.append(i)
  print len(all_legal)
  lmax=0
  sharpeMax=0
  for i in all_legal:
      if sharpeMax&lt;getSharpe(i):
          sharpeMax=getSharpe(i)
          lmax=i
  </code></pre>