title: scipy minimize with constraints
body: <p>I know that this question should be handled in the manual of scipy.optimize, but I don't understand it well enough. Maybe you can help</p>
  
  <p>I have a function (this is just an example, not the real function, but I need to understand it at this level):</p>
  
  <p>Edit (better example):</p>
  
  <p>Let's suppose I have a matrix</p>
  
  <pre><code>arr = array([[0.8, 0.2],[-0.1, 0.14]])
  </code></pre>
  
  <p>with a target function</p>
  
  <pre><code>def matr_t(t):
      return array([[t[0], 0],[t[2]+complex(0,1)*t[3], t[1]]]
  
  def target(t):
      arr2 = matr_t(t)
      ret = 0
      for i, v1 in enumerate(arr):
            for j, v2 in enumerate(v1):
                 ret += abs(arr[i][j]-arr2[i][j])**2
      return ret
  </code></pre>
  
  <p>now I want to minimize this target function under the assumption that the t[i] are real numbers, and something like <code>t[0]+t[1]=1</code></p>