I have the following set of equations:
$\frac{dv}{dt}=v-v_s(v,u)$
$\frac{du}{dt}=u-u_s(v,u)$
$v_s(v,u)=b \left(\frac{1}{1+a(u,v)}-\frac{e^{-v}}{a(u,v)+e^{-v}}\right)$
$u_s(v,u)=b \left(\frac{e^{u}}{a(u,v)+e^{u}}-\frac{1}{1+a(u,v)}\right)$
$a(v,u)=\frac{1}{u}\left(1-e^{-v}\right)+\frac{1}{v}\left(1-e^u\right)$
with the following initial conditions:
$u(0)=u_0$, $v(0)=v_0$
I need to obtain $v_s$ and $u_s$ first for every step $t$, and then plug them in the differential equations of $\frac{dv}{dt},\frac{du}{dt}$.
Since $v_s$ and $u_s$ have a recursion relation I can't manage to write a script that will solve these equations.
This is what I've obtained so far:
a[v_, u_] := (1/u) (1 - E^(-v)) + (1/v) (1 - E^u);
vs[v_, u_] := b (1/(a[v, u] + 1) - (E^(-v)))/(E^(-v) + a[v, u]);
us[v_, u_] := b (E^u/(E^u + a[v, u]) - 1/(1 + a[v, u]));
b = 1; u0 = 1; v0 = 1;
NDSolve[{v'[t] == v[t] - vs[v[t], u[t]], u'[t] == u[t] - us[v[t], u[t]],
v[0] == v0, u[0] == u0}, {v[t], u[t]}, {t, 0, 100}];
Full guidance or a scheme that will generalize this problem will be accepted as an answer.
NDSolve
, use ofSet
(=
) instead ofEqual
(==
)). It still generates errors, but they now seem to be the errors you were asking about. $\endgroup$ – aardvark2012 Nov 11 '17 at 11:48t=41.5
, so there isn't any problem with the definition ofvs
andus
. $\endgroup$ – Chris K Nov 11 '17 at 19:40