4.5. Populyatsiya rivojlanishining kompyuter modellari (Maltus va Verxulst modellari)
Maltusning matematik modelini (2) shaklda yozamiz
, bu erda
va Verxulst matematik modeli (3) shaklida
, bu yerda
bu yerda kerakli funksiya N(t) bo‘lsa, bu tenglamalar uchun populyatsiyaning rivojlanish modelining Eyler-Koshi formulalari bo‘yicha yechimi quyidagicha hisoblanadi:
Ushbu formulalar kompyuter modelining asosini tashkil qiladi.
program Popul_mf;
uses Crt, Graph;
var i, j, l, z, gM, gD, bg, bv, g0k, v0k, yk, tk, Nk, vk : integer;
a, b, r, k, as, t0, dt, ag, av, kg, kv, Np, N0, N1: real; ass: string;
t, v, N: array [1..2000] of real; ysl: boolean;
function f (z: integer; x: real): real;
begin if z = 1 then f:= (a-b)*x; {Maltusning matematik modeli}
if z = 2 then f:= r*x – k*sqr(x); {Ferxyulstning matematik modeli}
end;
BEGIN
a:=0.6; b:=0.5; { Maltus modelining dastlabki ma'lumotlari }
r:= 0.3; k:= 0.001; {Ferxyulst modelining dastlabki ma'lumotlari }
dt:=0.01;
for z:=1 to 2 do
begin
t0:=0; N0:=1000; {ikki modelning kirish modellari}
i:=1; t[1]:=t0; N[1]:=N0; v[1]:=f(z, N0);
repeat { populyatsiya sonining o’zgarish modeli}
Np:=N0+dt*f(z, N0); {Eyler formulasi }
N1:=N0+dt*(f(z, N0)+f(z, Np))/2; { Eyler- Koshi formulasi}
t0:=t0+dt; N0:=N1;
i:=i+1; t[i]:=t0; N[i]:=N1; v[i]:=f(z,N1);
if z = 1 then ysl:= abs(t0-10)<=0.1;
{ Maltus modeli uchun repeat siklini tugatish sharti }
if z =2 then ysl:= abs(N0-r/k)<= 1;
{ Ferxyulst modeli uchun reat siklini tugatish sharti }
until ysl;
clrscr;
if i < 25 then l:=1 else if i < 40 then l:=2 else l:= round(i/20);
Do'stlaringiz bilan baham: |