My code is as follows (there's about 100 lines before of setting values for the loop which seem to be working so I've just included necessary values):
fraction=np.array([0.5, 0.3, 0.2])
tauC=np.array([30.,300.,100000.])
dC_memory=np.zeros((1,3))
dC_frac=np.zeros((1,3))
for j in range(0,ens_num):
dC_memory=np.zeros((1,3))
for n in range(0,N-1):
# C02 Concentration
for m in range(0,3):
dC_frac[m]=fraction[m]*E[j,n+1]-dC_memory[m]/(tauC[m])
dC_memory[m]=dC_memory[m]+dC_frac[m]*dt
dC[j,n]=dC[j,n]+dC_frac[m]*dt
C[j,n+1]=C[j,n]+dC[j,n]
# Temperature
dT[j,n]=((T2eq*math.log(C[j,n+1]/Cpi)/math.log(2))-T[j,n])*(dt/tauT)
T[j,n+1]=T[j,n]+dT[j,n]
# Adaptation
dTadp[j,n]=(T[j,n]-Tadp[j,n])*dt/tauA
Tadp[j,n+1]=Tadp[j,n]+dTadp[j,n]
Tdiff[j,n+1]=0.5*(abs(T[j,n]-Tadp[j,n+1])+T[j,n]-Tadp[j,n+1])
if yi[j,n+1]+xi0[k]<=mu:
count[j]=count[j]+1/N
When I run this I get the error on the line dC[j,n]=dC[j,n]+dC_frac[m]*dt
saying
ValueError: setting an array element with a sequence.
I'm new to python but I know that python indexing starts from 0, but I cant understand why this code stops here.