My question relates to looping in Python.
I have an original $6$-sized vector, $F(n,t=0)=[1,0,0,0,0,0]$
Hence, the $n$-values range from $0 \rightarrow 5$.
This output for the original vector is just a series of values such as $F(0,0)=1, F(1,0) = 0$ , $F(2,0) = 0 $ etc...
This relates to a formula:
$$F(n,t+1) = -(l+(kn)-1)F(n,t) + k(n+1)F(n+1,t) + lF(n-1,t)$$
I will set $n = [0,1,2,3,4,5]$ and $t=[0,1,2,3,4,5]$
I need to create a loop to produce additional vectors using the original condition above.
$k=0.05$ and $l=0.01$ are constants
I can calculate this easily by hand but for future expansion to larger ranges of $n$ and $t$ I will need a computer programme.
Below is the beginning of my idea of what is required. This loop may be trivial to someone experienced in python coding. Any help is appreciated.
import numpy as np
import matplotlib.pyplot as plt
#Setting constants
k = 0.05
l = 0.01
t = np.arange(0,5,1)
n = np.arange(0,5,1)
#initial conditions:
F = np.zeros(n)
F0 = (1,0,0,0,0,0)
F[0] = F0
for i in range(t):
F[i+1] = -(k+(ln)-1)F[i]+l(n+1)F[i]+k*F[i]