"TypeError: el objeto 'function' no admite la asignación de elementos"
Tengo dos matrices
fi = [[f1], Nij = [[N11 N12 .......N1n],
[f2], [N21 N22 .......N2n],
. ...
. ...
[fn]] [Nn1 Nn2 .......Nnn]]
Quiero multiplicar:
f1 to each element of the 1st row,
f2 to each element of the 2nd row,
y así.
Es decir. quieroXij = fi*Nij
donde fi es una matriz de columnas y Xij & Nij es nxn matrix.
Traté de usar
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)
Me da este errorTypeError: 'function' object does not support item assignment
¿Por qué? y como resuelvo esto?