'Is there a way to add multiple function?

Here's the original code.

M_ran = np.array(np.random.randn(5))
N_ran = np.array(np.random.randn(5))

i,j,k = 0,0,0
omega_test = np.zeros(5)
random_test= np.zeros(5,dtype = 'complex_')
plane_test_list = []

for i in range(5) :   
    omega_test[i] = (2*np.pi*i)/t_sim
for j in range(5) :   
    random_test[j] = M_ran[j]*1 + N_ran[j]*1j
for k in range (5) :
    plane_test_list.append (lambda t: random_test[k]*np.exp(2*omega_test[k])*t) 

plane_test_array = np.array(plane_test_list) 

output = reduce(lambda x,y: x+y,plane_test_array)

Then, I get the error massage :

TypeError: unsupported operand type(s) for +: 'function' and 'function'

I also had tried to use the np.sum ,sum,map, or even changing it to list. I want to know, are there any tips to do it properly?

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source