I'm running into some trouble making a calculation over a list of elements for an equation which in result gives a list of elements for a second equation which influences the first equation. Equations are set as L1(i) = lamb1(i) * W1(i) and W1(i) = Q1(i-1)(R1/c1) + L1(i-1)(s1/c1) where the list values for lamb1 and Q1 are already known and initial list value for L1(0) = W1(0) = 0.
c1 = 1
R1 = 4.58
s1 = 8.41
lamb1 = [0.0, 0.0072, 0.0145, 0.0216, 0.0287, 0.0357, 0.0426, 0.0494, 0.0561, 0.0626, 0.0689]
Q1 = [0.0, 0.0612, 0.1219, 0.1821, 0.2417, 0.3006, 0.3586, 0.4158, 0.4719, 0.5268, 0.5802]
L1 = [0]
W1 = [0]
for i,j in zip(lamb1,W1):
L_1 = i * j
L1.append(L_1)
for i,j in zip(Q1,L1):
W_1 = (R1/c1) * i + (s1/c1) * j
W1.append(W_1)
When done like that the iteration for L1 stops at the second element and for W1 at the third element so I tried this:
for i,j in zip(lamb1,W1):
L_1 = i * j
print(L_1)
L1.append(L_1)
for i,j in zip(Q1,L1):
W_1 = (R1/c1) * i + (s1/c1) * j
W1.append(W_1)
But then the appending of L_1 and W_1 messes up the future results.
Any ideas of what is going wrong? Probably it is a basic mistake, but I've been scratching my head for a couple of days already.