I have these three differential equations in which I need to solve numerically:
$$ \frac{dn_0}{dt}= -n_0(t)W_{01}(t) + n_1(t)K_{10} $$
$$ \frac{dn_1}{dt}= -n_1(t)W_{12}(t) - n_1(t)K_{10} + n_2(t)K_{21} + n_0(t)W_{01}(t) $$
$$ \frac{dn_2}{dt}= n_1(t)W_{12}(t) - n_2(t)K_{21} $$
such that
$$ n_0(0)=1 $$ $$ n_0(N)=0 $$ $$ n_1(0)=0 $$ $$ n_1(N)=1 $$ $$ n_2(0)=0 $$ $$ n_2(N)=0 $$
Using the central finite difference formula:
$$\frac{n_{0}(t + \Delta t) - n_{0}(t - \Delta t)}{2\Delta t}=-n_0(t)W_{01}(t) + n_1(t)K_{10}$$
$$\frac{n_{1}(t + \Delta t) - n_{1}(t - \Delta t)}{2\Delta t}=-n_1(t)W_{12}(t) - n_1(t)K_{10} + n_2(t)K_{21} + n_0(t)W_{01}(t)$$
$$\frac{n_{2}(t + \Delta t) - n_{2}(t - \Delta t)}{2\Delta t}=n_1(t)W_{12}(t) - n_2(t)K_{21} $$
How do I determine the functions $n0$, $n1$ and $n2$ knowing that $n0 + n1 + n2 =1$, and that the three equations are coupled?
And I could not understand how to calculate the derivatives, how can I determine their value with the finite difference method without knowing the functions?
Can someone please help me?
Hmm, so I did it now.
$$ \frac{n_{0_{i+1}} - n_{0_{i-1}}}{2\Delta t}= -n_0(t_i)W_{01}(t_i) + n_1(t_i)K_{10}$$
with $$ t_i= (i-1)\Delta t $$ and $$ i= 2,3,... N-1 $$ for $$ \Delta t=\frac{b-a}{N-1} $$
knowing that this gives a system of the type $$ Au=B$$ I can not think of a way to fill the array. I say, on the right side of the equation, what values $ n_0(t_i)$ and $n_1(t_i)$ assume as $t_i$ varies?
I tried to implement in scilab, but to no avail