Message Boards Message Boards

1
|
7653 Views
|
10 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Second order system with different time scales

Hi, folks,

I'm trying to simulate this system below. It´s a system where each equation has a different time scale. "Is" is in function of "t", and "Iz" is in function of "tau", where tau=t*beta). And beta=5.

Clear[t];
a = 0.00001381594775713100;
c = 0.00007261477318255780;
j = 0.00004126704565565830;
d = 0.00006126704565565830;
b = 0.498812483;
r = 0.498812483;
Population = 40000;
mi = 0.4;
Na = Population*mi;
Ns = Population*(1 - mi);
beta = 5;
tau = beta*t;
ts = 400;
system = {
   Iz'[tau] == ((a*(Na - Iz[tau])*Iz[tau]) +
                               (j*(Ns - Is[tal])*Iz[tau]) -
                               ((b)*Iz[tau] )),
   Is'[t] == ((c*(Ns - Is[t])*Is[t]) +
                     (d*(Na - Iz[t])*Is[t]) -
                     ((r)*Is[t]))
   };
initialvalues = {Is[0] == 160, Iz[0] == 40};
solution = 
  NDSolve[Join[system, initialvalues], {Iz, Is }, {t, 0, ts}, {tau, 
    beta, (ts/beta)}];

The result of simulation is "5 t cannot be used as variable."

Some tricks?

Thanks.

POSTED BY: Luciano Chaves
10 Replies

You get an integro-differential system directly, using the original two functions Is and Iz:

system[[1]] /. DSolve[system[[2]], Is, t]
POSTED BY: Gianluca Gorni

As I said, I introduced a new unknown function Izt[t] that makes the diagram in the picture commute Iz[tau]=Izt[tau/beta], that is, Izt[t]=Iz[beta*t]. The replacement is made as Iz -> Function[\[Tau], Izt[\[Tau]/\[Beta]] so that the derivatives are done properly. I get system of two differential equation, where the two unknown functions Izt and Is are evaluated sometimes at t and sometimes at beta t. I can solve esplicitly one of the two equations and replace into the other, obtaining an integro-differential equation:

Clear[tau, beta, a, c, j, d, b, r, mi, Na, Ns, Population, ts];
system = {Iz'[
     tau] == ((a (Na - Iz[tau]) Iz[tau]) + (j (Ns - Is[tau]) Iz[
         tau]) - ((b)*Iz[tau])), 
   Is'[t] == ((c (Ns - Is[t]) Is[t]) + (d (Na - Iz[t]) Is[t]) - ((r)*
        Is[t]))};
newSystem = 
  system /. {Iz -> Function[\[Tau], Izt[\[Tau]/\[Beta]]]} /. 
   tau -> \[Beta]*t;
sol2 = DSolve[newSystem[[2]], Is, t]
newSystem[[1]] /. sol2

I am not sure what to do next.

Attachments:
POSTED BY: Gianluca Gorni

Dear Kay,

In a first place, thanks about your reply. I was thinking about it. I'm not sure about your suggested transformation.

I was carrying simulations with a cellular automata model, and trying to do an equivalent model with differential equations.

My cellular automata simulation brings me some oscillation and I hope the differential equation model either.

What do you think about Gianluca reply (the first one reply)?

Thanks.

POSTED BY: Luciano Chaves

Note this is not a delay equation. This is just s stretching of the time variable, therefore going from Tau to t you have Iz'[tau] -> beta Iz'[t] So that's why the first equation has a factor of 1/beta on the right hand side in my solution. A simple transformation of the equation from tau to t with tau=beta t

POSTED BY: Kay Herbert

Hi, Why not transform your first equation to have the same scale as your second equation tau/beta->t f[tau]-> f[t] and f'[tau]-> beta f'[t]

Clear[t];
a = 0.00001381594775713100;
c = 0.00007261477318255780;
j = 0.00004126704565565830;
d = 0.00006126704565565830;
b = 0.498812483;
r = 0.498812483;
Population = 40000;
mi = 0.4;
Na = Population*mi;
Ns = Population*(1 - mi);
beta = 5;
tau = beta*t;
ts = 400;

system = {Iz'[
     t] == ((a*(Na - Iz[t])*Iz[t]) + (j*(Ns - Is[t])*Iz[t]) - ((b)*
         Iz[t]))/beta, 
   Is'[t] == ((c*(Ns - Is[t])*Is[t]) + (d*(Na - Iz[t])*Is[t]) - ((r)*
        Is[t]))};

initialvalues = {Is[0] == 160, Iz[0] == 40};

solution = NDSolve[Join[system, initialvalues], {Iz, Is}, {t, 0, ts}]

Plot[Iz[t] /. solution, {t, 0, 10}]

Plot[Is[t] /. solution, {t, 0, 10}]

that gives me those results: enter image description here

POSTED BY: Kay Herbert

You have a mess of parenthesis. I think your system should look like:

Clear[t];
a = 0.00001381594775713100;
c = 0.00007261477318255780;
j = 0.00004126704565565830;
d = 0.00006126704565565830;
b = 0.498812483;
r = 0.498812483;
Population = 40000;
mi = 0.4;
Na = Population*mi;
Ns = Population*(1 - mi);
ts = 400;

system = {
        Iz'[5t]/5 == a Iz[5t](Na - Iz[5t])  + j Iz[5t](Ns - Is[5t]) - b Iz[5t],
        Is'[t] == c Is[t](Ns - Is[t]) + d Is[t](Na - Iz[t]) - r Is[t]
        };

initialvalues = {Is[0] == 160, Iz[0] == 40};

solution = NDSolve[Join[system, initialvalues], {Iz, Is}, {t, 0, ts}];

But then it is a sort of Delay Differential Equation. So if you run it you get an error:

Initial history needs to be specified for all variables for delay-differential equations. >>

And if you look at the help DDLs have usually this sort of initial conditions:

ndssol = First[
   NDSolve[{x'[t] == y[t], y'[t] == -x[t - 1], x[t /; t <= 0] == t^2, 
     y[t /; t <= 0] == 2 t}, {x, y}, {t, 0, 5}]];
Plot[Evaluate[{x[t], y[t]} /. ndssol], {t, 0, 5}]

enter image description here

But then if here for example you change time shift into time rescaling like:

ndssol = First[
   NDSolve[{x'[t] == y[t], y'[t] == -x[2 t], x[t /; t <= 0] == t^2, 
     y[t /; t <= 0] == 2 t}, {x, y}, {t, 0, 5}]];
Plot[Evaluate[{x[t], y[t]} /. ndssol], {t, 0, 5}]

You get an error:

The method currently implemented for delay differential equations does not support delays that depend directly on the time variable or dependent variables. >>

So I think we might be in trouble here. An expert opinion is needed.

POSTED BY: Sam Carrettie
Posted 9 years ago

Yes, I agree it´s not a classical differential system. So, probabily It´s not possible to integrate those with NDSolve, is it? Thanks.

POSTED BY: Updating Name

Sam,

I´m not sure if this system has a kind of delay, despite the error message from Mathematica.

Actually, when we think about a system with delay, all equations have the same time scale for the derivatives. In others words, the left side of equations are in function of "t", and in the rigth side we have something in "t - x" or "t + x".

Thanks.

POSTED BY: Luciano Chaves

First I replace the function Iz[tau] with its equivalent Izt[t] such that Iz[tau]=Izt[tau/beta]

Clear[tau, beta, a, c, j, d, b, r, mi, Na, Ns, Population, ts];
system = {Iz'[
     tau] == ((a (Na - Iz[tau]) Iz[tau]) + (j (Ns - Is[tau]) Iz[
         tau]) - ((b)*Iz[tau])), 
   Is'[t] == ((c (Ns - Is[t]) Is[t]) + (d (Na - Iz[t]) Is[t]) - ((r)*
        Is[t]))};
newSystem = 
 system /. {Iz -> Function[\[Tau], Izt[\[Tau]/\[Beta]]]} /. 
  tau -> \[Beta]*t

What I get is not a classical differential system, because the unknown functions are evaluated at different times:

{Derivative[1][Izt][t]/\[Beta] == -b Izt[t] + 
   j (Ns - Is[t \[Beta]]) Izt[t] + a (Na - Izt[t]) Izt[t], 
 Derivative[1][Is][t] == -r Is[t] + c (Ns - Is[t]) Is[t] + 
   d Is[t] (Na - Izt[t/\[Beta]])}
POSTED BY: Gianluca Gorni

Yes, I agree it´s not a classical differential system. So, probabily It´s not possible to integrate those with NDSolve, is it? Thanks.

POSTED BY: Luciano Chaves
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract