SIR model with Maxima

From wikiluntti
Revision as of 13:35, 12 August 2021 by Mol (talk | contribs) (Created page with "== Introduction == Use WxMaxima to calculate SIR model. == Theory == thumb|SIR model <syntaxhighlight> depends([S,I,s, i],t); eqS : 'diff(S, t) = -β*S*...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

Use WxMaxima to calculate SIR model.

Theory

SIR model

<syntaxhighlight> depends([S,I,s, i],t);

eqS : 'diff(S, t) = -β*S*I; eqI : 'diff(I, t) = β*S*I - α*I;

factor( rhs(eqI)>0);

eqsN : subst([S=N*s, I=N*i], eqS ); eqiN : subst([S=N*s, I=N*i], eqI );

eqs1 : ev(eqsN, nouns); eqi1 : ev(eqiN, nouns);

eqs : eqs1/N; eqi : ratsimp( eqi1/N );

plotdf([subst( [β=b], rhs(eqs)), subst( [α=a, β=b], rhs(eqi))], [s,i], [parameters,"a=10000,b=1.1,N=1000"], [s,0,75], [i,0,60], [sliders,"b=0.5:2.5"] ); </syntaxhiglight>