title: "TypeError: 'function' object does not support item assignment"
body: <p>I have two matrices </p>
  
  <pre><code>fi = [[f1],           Nij = [[N11 N12 .......N1n],
        [f2],                  [N21 N22 .......N2n],
         .                            ...
         .                            ...
        [fn]]                  [Nn1 Nn2 .......Nnn]]
  </code></pre>
  
  <p>I want to multiply:</p>
  
  <pre><code>f1 to each element of the 1st row,
  f2 to each element of the 2nd row,
  </code></pre>
  
  <p>and so on.</p>
  
  <p>I.e. I want <code>Xij = fi*Nij</code> where fi is a column matrix and Xij &amp; Nij is nxn matrix.</p>
  
  <p>I tried using </p>
  
  <pre><code>import numpy as np
  
  fi = np.linspace(1,5, num =5)
  fi = np.asmatrix(fi)
  
  def Xij(ai):
      Nij = np.ones((5,5))
      for i in range(len(fi)):
      for j in range(len(fi)):
          Xij[i,j] = ai[i] * Nij[i,j]
  return Xij
  
  Zij = Xij(fi)
  </code></pre>
  
  <p>It gives me this error <code>TypeError: 'function' object does not support item assignment</code> </p>
  
  <p>Why? and how do I solve this?</p>