kill(all)$

biotech : numerical model (rk4),epidemic: one ode, version 1.0a
peter.vlasschaert@gmail.com,10/04/2020

→ :rk4 :Runge-Kutta 4e order

load 'package'
============

load(lrats)$

output : rational , blocked
======================

ratprint :false$

→ numerical solution

epidemic model ( =simple)
======================

p1:'diff(x,t) = r*x*(1-x);

p1a: [r=.5,x0=0.02];

p2a:subst(p1a,p1);

p2a1:rhs(p2a);

numerical : with RK 'wxmaxima'
-------------------------------------------------
solution : epidemic model.

Function: rk 
------------------------------------------------------------------------------------------- 
    rk (ODE, var, initial, domain)  
    rk ([ODE1, …, ODEm], [v1, …, vm], [init1, …, initm], domain)
-------------------------------------------------------------------------------------------

info: How to use ,rk , one ode
---------------------------------------------
==============================.
→      dx/dt = t - x^2
→      results: rk(t-x^2,x,1,[t,0,8,0.1])$
→      plot2d ([discrete, results])$
==============================

variable:
-------------
rem :dependent var

vr:x;

initial value :x(t=0)
----------------------------
x0=.02

init:rhs(p1a[2]);

domain : simulation 't=time' ()
---------------------------------------------
simulation period: 20 days

domain :[t,0,19,1];

solve
--------

p3:rk(rhs(p2a),vr,init,domain);

plot solution: discrete values
-------------------

wxplot2d([discrete,p3],[style,points],[color,red]);

wxplot2d([[discrete,p3],[discrete,p3]],[style,points,lines],[color,red,blue]);

rem : these procedure 'rk',numerical solutions of system of differential equations.

appendix : qualitative picture 'phase plot = dy/dx=slope', one ode

How to use :plotdf 
================

step 1: conversion 'variables'
=========================
x→y    ( person infected > 0)
t →x    ( time                       > 0 )
----------------------------------------------------------------------
only region : intrest x>0,y>0,physical meaning.
_______________________________________

p4:subst([x=y,t=x],p1);

step2:parameter inside ode
=======================
example :r

p4a:subst([r=.5],p4);

step3: plotdf for ode
==================

p4ba:plotdf(rhs(p4a),[trajectory_at,0,0],[xradius,1.2],[yradius,1.2]);

rem : horizontal ,y = 0 ,default
                               ,y = 1, trajectory_at,0,0  →trajectory_at,0,1 , 'p4ba'

two zeros for rhs ,p4a

p4b1:solve(rhs(p4a)=0,y);

first :zero    ,@ y=0
================
→ plotdf(rhs(p4a),[trajectory_at,0,0],[xradius,1.2],[yradius,1.2]);

p4b1a:lhs(p4a)=at(rhs(p4a),p4b1[1]);

second :zero ,@ y=1
==================
→ plotdf(rhs(p4a),[trajectory_at,0,1],[xradius,1.2],[yradius,1.2]);

p4b1b:lhs(p4a)=at(rhs(p4a),p4b1[2]);

When click with mouse on the graph
red horizontal lines, y=0 , y=1,see: trajectory  red

general :remark , used to analysis any differential equation
→ reaction kinetics in chemical engineering

info : Menu : Maxima
==================

values;

functions;