[Scilab-users] Corona modelling

classic Classic list List threaded Threaded
23 messages Options
12
Heinz Nabielek-3 Heinz Nabielek-3
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Corona modelling

Colleagues:

is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?


S= number Susceptible: S'=-aSI
I=  number Infected: I'=aSI - bI
R= number Recovered: R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.

Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Tim Wescott Tim Wescott
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

This will be a straightforward application of the ODE solver.

Type "help ode" for more detail.

You'll make a function that takes the vector x = [S; I; R] as an
argument and returns [S'; I'; R'].  Then you'll call that function with
some starting x and let it play out.

You can speed up computation if you provide the Jacobian of f as a
function -- if you don't, the solver will calculate it at each time
step.

On Mon, 2020-03-30 at 02:14 +0200, Heinz Nabielek wrote:

> Colleagues:
>
> is there an straightforward Scilab approach for solving the three
> coupled nonlinear differential equations of first order given by the
> Standard Model of Epidemics?
>
>
> S= number Susceptible: S'=-aSI
> I=  number Infected: I'=aSI - bI
> R= number Recovered: R'=bI
> whereby 'a' is the transmission coefficient, 'b' the recovery factor
> (after Reed-Frost 1928).
> Initial values for S, I, R are available.
>
> Thank you
> Heinz
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>
>
--

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by Heinz Nabielek-3

Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction

function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");

        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        

    end
end

clf

draw(0.3,1/15)

Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :
Colleagues:

is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?


S= number Susceptible: 		S'=-aSI
I=  number Infected:		I'=aSI - bI
R= number Recovered: 		R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.

Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

Merci Stéphane, for the very interesting code and Heinz for the reference to the math behind the epidemy “curve”, or one of its models.

 

 

 

From: users <[hidden email]> On Behalf Of Stéphane Mottelet
Sent: Monday, March 30, 2020 9:14 AM
To: [hidden email]
Subject: Re: [Scilab-users] Corona modelling

 

Hello Heinz,

Here is an interactive version (made for my children last week...) :

 
// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction
 
function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");
 
        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
 
    end
end
 
clf
 
draw(0.3,1/15)
 

Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :

Colleagues:
 
is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?
 
 
S= number Susceptible:          S'=-aSI
I=  number Infected:            I'=aSI - bI
R= number Recovered:            R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.
 
Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Heinz Nabielek-3 Heinz Nabielek-3
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by mottelet
On 30.03.2020, at 08:13, Stéphane Mottelet <[hidden email]> wrote:

Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020....


Great many thanks:

o The SIR model is great and can be readily understood.

o Scilab is great: one line of code where big EXCEL sheet produced a mess.

o Scilab friends and colleagues are great: instantaneous and real help.

If the modelling is anywhere near to right, it will soon be over in Austria (cyan circles are recorded infections). But this is likely over-optimistic.....
Heinz


______________
Dr Heinz Nabielek
Schüttelstrasse 77A/11
A-1020 Wien, Österreich
Tel +43 1 276 56 13
cell +43 677 616 349 22
[hidden email]

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Vesela Pasheva Vesela Pasheva
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

Hello colleagues,

I would like to know whether the variable D of dead persons could be
included in the model considered. Up till now the model considers the
variables S - susceptible, I - infected and R - recovered. Where do the
Dead persons D go.
Of course i such case the system will be of four differential equations.

Best regards

Vesela

На 30-03-2020 15:38, Heinz Nabielek написа:

>> On 30.03.2020, at 08:13, Stéphane Mottelet
>> <[hidden email]> wrote:
>
>> Hello Heinz,
>>
>> Here is an interactive version (made for my children last week...) :
>>
>> // Confinement COVID-19 !
>> // Stephane MOTTELET, UTC
>> // Tue Mar 24 08:55:03 CET 2020....
>
> Great many thanks:
>
> o The SIR model is great and can be readily understood.
>
> o Scilab is great: one line of code where big EXCEL sheet produced a
> mess.
>
> o Scilab friends and colleagues are great: instantaneous and real
> help.
>
> If the modelling is anywhere near to right, it will soon be over in
> Austria (cyan circles are recorded infections). But this is likely
> over-optimistic.....
> Heinz
>
> ______________
> Dr Heinz Nabielek
> Schüttelstrasse 77A/11
> A-1020 Wien, Österreich
> Tel +43 1 276 56 13
> cell +43 677 616 349 22
> [hidden email]
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

Hi,

In Wikipedia article " Mathematical modelling of infectious disease " it says that people counted in R have been infected and removed from the disease due to immunization or death.

I am not an expert but the fatality ratio could be defined as a percentage of the people infected 'I'.

Regards,
Rafael

-----Original Message-----
From: users <[hidden email]> On Behalf Of Vesela Pasheva
Sent: Monday, March 30, 2020 5:13 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: Re: [Scilab-users] Corona modelling

Hello colleagues,

I would like to know whether the variable D of dead persons could be
included in the model considered. Up till now the model considers the
variables S - susceptible, I - infected and R - recovered. Where do the
Dead persons D go.
Of course i such case the system will be of four differential equations.

Best regards

Vesela

На 30-03-2020 15:38, Heinz Nabielek написа:

>> On 30.03.2020, at 08:13, Stéphane Mottelet
>> <[hidden email]> wrote:
>
>> Hello Heinz,
>>
>> Here is an interactive version (made for my children last week...) :
>>
>> // Confinement COVID-19 !
>> // Stephane MOTTELET, UTC
>> // Tue Mar 24 08:55:03 CET 2020....
>
> Great many thanks:
>
> o The SIR model is great and can be readily understood.
>
> o Scilab is great: one line of code where big EXCEL sheet produced a
> mess.
>
> o Scilab friends and colleagues are great: instantaneous and real
> help.
>
> If the modelling is anywhere near to right, it will soon be over in
> Austria (cyan circles are recorded infections). But this is likely
> over-optimistic.....
> Heinz
>
> ______________
> Dr Heinz Nabielek
> Schüttelstrasse 77A/11
> A-1020 Wien, Österreich
> Tel +43 1 276 56 13
> cell +43 677 616 349 22
> [hidden email]
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Heinz Nabielek-3 Heinz Nabielek-3
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by Vesela Pasheva
It is generally assumed that 1% of the infected will die. But that would not be part of the modelling, depends mainly on local health services.

Heinz

> On 30.03.2020, at 16:12, Vesela Pasheva <[hidden email]> wrote:
>
> Hello colleagues,
>
> I would like to know whether the variable D of dead persons could be included in the model considered. Up till now the model considers the variables S - susceptible, I - infected and R - recovered. Where do the Dead persons D go.
> Of course i such case the system will be of four differential equations.
>
> Best regards
>
> Vesela
>
> На 30-03-2020 15:38, Heinz Nabielek написа:
>>> On 30.03.2020, at 08:13, Stéphane Mottelet
>>> <[hidden email]> wrote:
>>> Hello Heinz,
>>> Here is an interactive version (made for my children last week...) :
>>> // Confinement COVID-19 !
>>> // Stephane MOTTELET, UTC
>>> // Tue Mar 24 08:55:03 CET 2020....
>> Great many thanks:
>> o The SIR model is great and can be readily understood.
>> o Scilab is great: one line of code where big EXCEL sheet produced a
>> mess.
>> o Scilab friends and colleagues are great: instantaneous and real
>> help.
>> If the modelling is anywhere near to right, it will soon be over in
>> Austria (cyan circles are recorded infections). But this is likely
>> over-optimistic.....
>> Heinz
>> ______________
>> Dr Heinz Nabielek
>> Schüttelstrasse 77A/11
>> A-1020 Wien, Österreich
>> Tel +43 1 276 56 13
>> cell +43 677 616 349 22
>> [hidden email]
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling


R = recovered = people who can not infect others anymore...this includes the dead people...  (or not?)

there are some nice introducton videos at YouTube about this....even showing the mentioned model...


Best regards,
Philipp


Am Mo., 30. März 2020 um 18:57 Uhr schrieb Heinz Nabielek <[hidden email]>:
It is generally assumed that 1% of the infected will die. But that would not be part of the modelling, depends mainly on local health services.

Heinz

> On 30.03.2020, at 16:12, Vesela Pasheva <[hidden email]> wrote:
>
> Hello colleagues,
>
> I would like to know whether the variable D of dead persons could be included in the model considered. Up till now the model considers the variables S - susceptible, I - infected and R - recovered. Where do the Dead persons D go.
> Of course i such case the system will be of four differential equations.
>
> Best regards
>
> Vesela
>
> На 30-03-2020 15:38, Heinz Nabielek написа:
>>> On 30.03.2020, at 08:13, Stéphane Mottelet
>>> <[hidden email]> wrote:
>>> Hello Heinz,
>>> Here is an interactive version (made for my children last week...) :
>>> // Confinement COVID-19 !
>>> // Stephane MOTTELET, UTC
>>> // Tue Mar 24 08:55:03 CET 2020....
>> Great many thanks:
>> o The SIR model is great and can be readily understood.
>> o Scilab is great: one line of code where big EXCEL sheet produced a
>> mess.
>> o Scilab friends and colleagues are great: instantaneous and real
>> help.
>> If the modelling is anywhere near to right, it will soon be over in
>> Austria (cyan circles are recorded infections). But this is likely
>> over-optimistic.....
>> Heinz
>> ______________
>> Dr Heinz Nabielek
>> Schüttelstrasse 77A/11
>> A-1020 Wien, Österreich
>> Tel +43 1 276 56 13
>> cell +43 677 616 349 22
>> [hidden email]
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Tim Wescott Tim Wescott
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by Vesela Pasheva
Someone was tagging "R" as "removed", which works if it's the aggregate
of "live and no longer contagious" and "dead".

Actually assessing the proportion of R depends on the local health
system, and, to some extent, the size of the peak -- the main reason
we're quarantining is to bring the peak down by broadening it.  The
percentage of 'R' that's dead people is going to depend on how burdened
the health care system is in any locality.

In cold-blooded mathematical terms it's just another dimension to the
modeling, but it's on the output side of the differential equation; it
doesn't have a great impact (as modeled) on the actual dynamics of
those three variables.

On Mon, 2020-03-30 at 17:12 +0300, Vesela Pasheva wrote:

> Hello colleagues,
>
> I would like to know whether the variable D of dead persons could be
> included in the model considered. Up till now the model considers
> the
> variables S - susceptible, I - infected and R - recovered. Where do
> the
> Dead persons D go.
> Of course i such case the system will be of four differential
> equations.
>
> Best regards
>
> Vesela
>
> На 30-03-2020 15:38, Heinz Nabielek написа:
> > > On 30.03.2020, at 08:13, Stéphane Mottelet
> > > <[hidden email]> wrote:
> > > Hello Heinz,
> > >
> > > Here is an interactive version (made for my children last
> > > week...) :
> > >
> > > // Confinement COVID-19 !
> > > // Stephane MOTTELET, UTC
> > > // Tue Mar 24 08:55:03 CET 2020....
> >
> > Great many thanks:
> >
> > o The SIR model is great and can be readily understood.
> >
> > o Scilab is great: one line of code where big EXCEL sheet produced
> > a
> > mess.
> >
> > o Scilab friends and colleagues are great: instantaneous and real
> > help.
> >
> > If the modelling is anywhere near to right, it will soon be over in
> > Austria (cyan circles are recorded infections). But this is likely
> > over-optimistic.....
> > Heinz
> >
> > ______________
> > Dr Heinz Nabielek
> > Schüttelstrasse 77A/11
> > A-1020 Wien, Österreich
> > Tel +43 1 276 56 13
> > cell +43 677 616 349 22
> > [hidden email]
> > _______________________________________________
> > users mailing list
> > [hidden email]
> > http://lists.scilab.org/mailman/listinfo/users
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
--

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Heinz Nabielek-3 Heinz Nabielek-3
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

On 30.03.2020, at 20:37, Tim Wescott <[hidden email]> wrote:

Someone was tagging "R" as "removed", which works if it's the aggregate
of "live and no longer contagious" and "dead".

Actually assessing the proportion of R depends on the local health
system, and, to some extent, the size of the peak -- the main reason
we're quarantining is to bring the peak down by broadening it.


The usual display of the INFECTED population as a series of normal distributions is not quite right, but a good enough approximation.

It is correct, that the reduction of the transmission coefficient delays the peak and makes it smaller......
Heinz















 The
percentage of 'R' that's dead people is going to depend on how burdened
the health care system is in any locality.

In cold-blooded mathematical terms it's just another dimension to the
modeling, but it's on the output side of the differential equation; it
doesn't have a great impact (as modeled) on the actual dynamics of
those three variables.

On Mon, 2020-03-30 at 17:12 +0300, Vesela Pasheva wrote:
Hello colleagues,

I would like to know whether the variable D of dead persons could be 
included in the model considered. Up till now the model considers
the 
variables S - susceptible, I - infected and R - recovered. Where do
the 
Dead persons D go.
Of course i such case the system will be of four differential
equations.

Best regards

Vesela

На 30-03-2020 15:38, Heinz Nabielek написа:
On 30.03.2020, at 08:13, Stéphane Mottelet
<[hidden email]> wrote:
Hello Heinz,

Here is an interactive version (made for my children last
week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020....

Great many thanks:

o The SIR model is great and can be readily understood.

o Scilab is great: one line of code where big EXCEL sheet produced
a
mess.

o Scilab friends and colleagues are great: instantaneous and real
help.

If the modelling is anywhere near to right, it will soon be over in
Austria (cyan circles are recorded infections). But this is likely
over-optimistic.....
Heinz



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
RolandB RolandB
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

As there have already been some cases where persons have been infected twice,
you would have to take into account that only a finite percentage of
infected people become immune and that this immunity might also only last
some finite time.

Another thought experiment would be to randomly test some percentage of
people every some days and remove them by isolation in case they are
infected.

Further, after someone becomes ill or is tested positive, you could
determine the people he was in contact with (to a certain percentage,
because they would not remember everyone they had been in contact with) and
have them tested too.

Aside from the mathematical problem, I think in order to be able to return
to a somewhat normal life without a high risk of provoking another wave
(maybe several of them), we need tests that detect the virus directly
(antigen or DNA tests, as antibodies take too long to rise) and we need them
ridiculously cheap. We need to be able to test everyone at least twice a
week, preferably every other day or even every day.
I think I have seen Influenza rapid antigen tests for about 3,5 Euro in some
tens quantities. If one were to produce them in hundreds of millions per day
(you know how fast the Chinese can ramp up factories if there is a demand),
such a test should be able to be produced for less than an Euro.
Combined with an app that tracks everyone's path (I know, protection of
privacy is important, but there should be a way to ensure privacy while
allowing to be able to detect if one has been in close vicinity of an
infected person), that should allow us to avoid an oscillating cycle of
reinfection waves.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Tan Chin Luh Tan Chin Luh
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Fwd: Re: Corona modelling

In reply to this post by mottelet
Just notice that this email was stuck due to the image attached was too large, and notice the new post by Claus with the SEIR model from Matlab, perhaps Scilabers could make the model more realistic together.

CL

============ Forwarded message ============
From: Chin Luh Tan <[hidden email]>
To: "Users mailing list for Scilab"<[hidden email]>
Date: Thu, 30 Apr 2020 00:03:46 +0800
Subject: Re: [Scilab-users] Corona modelling
============ Forwarded message ============

Hi, 

I just modified Stephane's nice GUI to make it able to load the real world data from internet so that we could overlapped the data to the SIR model to study the effect of locked-down, and the meaning of the coefficients. 

From some reading from the internet, the "Susceptible" population is kind of like difficult to determined, and some suggested to use "current cases" as "optimum model" assuming the condition is recovering. As or the "optional model", the "total population" is being used.

While "beta" is the transmission coefficient, "gamma" the recovery factor, can anyone explained more details, perhaps in layman term, how to relate these  parameters to one country condition, such as the relationship between gamma with the number of days (what days is it referring to), beta "actual meaning" in layman term, and perhaps link with some "technical term" the newspaper always seen on papers? 

I attached the GUI, which will load 3 sets of data from Johns Hopkins Github, (https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series)
which could be download using following 3 lines directly from the Scilab:


--> fn = getURL('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv')
--> fn = getURL('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv')

and run the GUI as attached.




rgds,
CL


---- On Mon, 30 Mar 2020 14:13:40 +0800 Stéphane Mottelet <[hidden email]> wrote ----




Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction

function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");

        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        

    end
end

clf

draw(0.3,1/15)


Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :
Colleagues:

is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?


S= number Susceptible: 		S'=-aSI
I=  number Infected:		I'=aSI - bI
R= number Recovered: 		R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.

Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

CoronaSimv2.sce (5K) Download Attachment
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: Corona modelling

Hi,

My experience with the SIR model (not SEIR) is that the estimated parameters are very sensitive to the initial condition of the Infected pool. Hence, this initial condition should be also considered as a parameter to be identified. However, the main problem (at least with France data) is that fitting Infected and Recovered (cured or dead people) together gives not satisfactory results.

My two cents...

S.

Le 30/04/2020 à 18:44, Chin Luh Tan a écrit :
Just notice that this email was stuck due to the image attached was too large, and notice the new post by Claus with the SEIR model from Matlab, perhaps Scilabers could make the model more realistic together.

CL

============ Forwarded message ============
From: Chin Luh Tan <[hidden email]>
To: "Users mailing list for Scilab"<[hidden email]>
Date: Thu, 30 Apr 2020 00:03:46 +0800
Subject: Re: [Scilab-users] Corona modelling
============ Forwarded message ============

Hi, 

I just modified Stephane's nice GUI to make it able to load the real world data from internet so that we could overlapped the data to the SIR model to study the effect of locked-down, and the meaning of the coefficients. 

From some reading from the internet, the "Susceptible" population is kind of like difficult to determined, and some suggested to use "current cases" as "optimum model" assuming the condition is recovering. As or the "optional model", the "total population" is being used.

While "beta" is the transmission coefficient, "gamma" the recovery factor, can anyone explained more details, perhaps in layman term, how to relate these  parameters to one country condition, such as the relationship between gamma with the number of days (what days is it referring to), beta "actual meaning" in layman term, and perhaps link with some "technical term" the newspaper always seen on papers? 

I attached the GUI, which will load 3 sets of data from Johns Hopkins Github, (https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series)
which could be download using following 3 lines directly from the Scilab:


--> fn = getURL('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv')
--> fn = getURL('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv')

and run the GUI as attached.




rgds,
CL


---- On Mon, 30 Mar 2020 14:13:40 +0800 Stéphane Mottelet <[hidden email]> wrote ----




Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction

function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");

        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        

    end
end

clf

draw(0.3,1/15)


Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :
Colleagues:

is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?


S= number Susceptible: 		S'=-aSI
I=  number Infected:		I'=aSI - bI
R= number Recovered: 		R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.

Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Tan Chin Luh Tan Chin Luh
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: Corona modelling

Thanks Stephane for your sharing. 

I agreed with you that the Initial population (susceptible individuals) is one of the unknown parameters, so there will be 3 parameters to tune in SIR model.

As the parameters are somehow related to each other, and I read somewhere that the Gamma is rather fixed as the recovery days shall be somehow known by now. 

So if we can set the Gamma to a smaller range, we would have only 2 to adjust to get some reasonable prediction? 

One more parameter is the starting date, as the data started from 1/22/20, but I think each country shall be adjusted for their actual date where the virus start to spread. 

Any ideas are welcome. 




Thanks.

Regards,
Chin Luh


---- On Fri, 01 May 2020 01:12:12 +0800 Stéphane Mottelet <[hidden email]> wrote ----

Hi,

My experience with the SIR model (not SEIR) is that the estimated parameters are very sensitive to the initial condition of the Infected pool. Hence, this initial condition should be also considered as a parameter to be identified. However, the main problem (at least with France data) is that fitting Infected and Recovered (cured or dead people) together gives not satisfactory results.

My two cents...

S.

Le 30/04/2020 à 18:44, Chin Luh Tan a écrit :

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
http://lists.scilab.org/mailman/listinfo/users
Just notice that this email was stuck due to the image attached was too large, and notice the new post by Claus with the SEIR model from Matlab, perhaps Scilabers could make the model more realistic together.

CL


============ Forwarded message ============
From: Chin Luh Tan <[hidden email]>
To: "Users mailing list for Scilab"<[hidden email]>
Date: Thu, 30 Apr 2020 00:03:46 +0800
Subject: Re: [Scilab-users] Corona modelling
============ Forwarded message ============

Hi, 

I just modified Stephane's nice GUI to make it able to load the real world data from internet so that we could overlapped the data to the SIR model to study the effect of locked-down, and the meaning of the coefficients. 

From some reading from the internet, the "Susceptible" population is kind of like difficult to determined, and some suggested to use "current cases" as "optimum model" assuming the condition is recovering. As or the "optional model", the "total population" is being used.

While "beta" is the transmission coefficient, "gamma" the recovery factor, can anyone explained more details, perhaps in layman term, how to relate these  parameters to one country condition, such as the relationship between gamma with the number of days (what days is it referring to), beta "actual meaning" in layman term, and perhaps link with some "technical term" the newspaper always seen on papers? 

I attached the GUI, which will load 3 sets of data from Johns Hopkins Github, (https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series)
which could be download using following 3 lines directly from the Scilab:


--> fn = getURL('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv')

and run the GUI as attached.





rgds,
CL



---- On Mon, 30 Mar 2020 14:13:40 +0800 Stéphane Mottelet <[hidden email]> wrote ----




Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction

function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");

        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        

    end
end

clf

draw(0.3,1/15)



Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :
Colleagues:

is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?


S= number Susceptible: 		S'=-aSI
I=  number Infected:		I'=aSI - bI
R= number Recovered: 		R'=bI
whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).
Initial values for S, I, R are available.

Thank you
Heinz
_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet


_______________________________________________
users mailing list



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
hdf hdf
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by RolandB
Hello, My contribution, I've done it with Xcos: where you can play with other parameters like a limited immunization (delta), deaths (Mu) etc ... I'm thinking to modelize the healthcare system showing the number of beds saturation effect. But time is missing ...

Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Hervé de Foucault
hdf hdf
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

and here are the results, with parameters given:

Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Hervé de Foucault
Heinz Nabielek-3 Heinz Nabielek-3
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

And how does it compare with Johns Hopkins?
Heinz



> On 07.05.2020, at 13:49, hdf <[hidden email]> wrote:
>
> and here are the results, with parameters given:  
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
hdf hdf
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

Hello Heinz,
Before comparing with John Hopkins' data and try to identify the different parameters I wanted to 'improve' the model. I have read several interesting articles on the web. One of them, written by David Madore, explains (in french) that the recovery model would be better at a "constant recovery time" instead of using an "exponential distribution of probability whose expected value is 1/γ" like in the traditional SIR model.
I agree with him because I could recognized a "simple time delay" in his explanations
So in the below diagram I replaced the gamma (γ) feedback on the infected integrator by a variable delay and add a super function diagram to model the healthcare system with:
- One input: infected people per day.
- Two outputs: Recovered and unfortunately dead people per day.
The other parameters are percentages of 'symtomatic', 'hospitabized', 'Reanimated' and 'dead' people on one hand and delays before being 'healed', 'hopitalized' and 'reanimated', but also 'incubation' time on the other hand.

Here are some of my results:

Funny 'infected' curve and its derive right ?
I am thinking of studying the FFT of the real John Hopkings' curves to identify the delays to put inside my healthcare system model.
But I'm running out of time before I have to work back next monday.
Hervé de Foucault


Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Hervé de Foucault
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Corona modelling

In reply to this post by mottelet
Hello,

Thank you Stéphane for this nice example of applied GUI.
The screenshot of the Xcos model from Hervé is also quite stimulating.

About the GUI run on Scilab 6.1.0, i have noticed that the Scilab filebrowser is blinking when using any of both sliders, as if it was updated/redisplayed for each slider step. It continues to blink for a while even after stopping using the control, likely until all queued steps are performed. This behavior can be seen when sliding with the mouse, as well as with arrows, but not with page_up and page_down keys. So, apparently only performing small steps triggers it.

Does anyone confirm this behavior, or is it only on my PC on Windows7 ?

Best regards
Samuel

Le 30/03/2020 à 08:13, Stéphane Mottelet a écrit :

Hello Heinz,

Here is an interactive version (made for my children last week...) :

// Confinement COVID-19 !
// Stephane MOTTELET, UTC
// Tue Mar 24 08:55:03 CET 2020
// 
function dydt=sir(t, y, bet, gam, N)
    dydt=[-bet/N*y(1)*y(2)
           bet/N*y(1)*y(2)-gam*y(2)  
           gam*y(2)];
endfunction

function draw(bet, gam)
    t=0:1:360;
    N=6e7;
    if exists("gcbo") && is_handle_valid(gcbo)
        sb = gcbo;
        if sb.tag=="beta"
            bet=sb.value;
            gam=findobj("gamma").value
        else
            gam=sb.value;
            bet=findobj("beta").value
        end
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        curves = findobj("curves");
        curves.children(1).data(:,2)=y(3,:);
        curves.children(2).data(:,2)=y(2,:);
        curves.children(3).data(:,2)=y(1,:);
    else
        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));
        scf(0)
        clf
        plot(t,y)
        gce().tag="curves";
        gce().children.thickness=2;
        legend("Susceptible","Infected","Recovered",-1)
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.85,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0.15,"max",0.3,"value",bet,...
        "Callback","draw","tag","beta");
        
        uicontrol("style","text",...
        "string","$\beta$",...
        "units","normalized",...
        "Position", [0.85,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        
        
        sb1 = uicontrol("style","slider",...
        "units","normalized",...
        "Position", [0.90,0.2,0.05,0.48],...
        "BackgroundColor", [1,1,1],...
        "Callback_Type",12,...
        "sliderstep",[1/1000,1/10],...
        "min",0,"max",1/15,"value",gam,...
        "Callback","draw","tag","gamma");

        uicontrol("style","text",...
        "string","$\gamma$",...
        "units","normalized",...
        "Position", [0.9,0.125,0.05,0.08],...
        "BackgroundColor", [1,1,1],...
        "HorizontalAlignment","center");        

    end
end

clf

draw(0.3,1/15)



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
12