Kira1234
Kira1234

Reputation: 1

JiTCDDE not giving expected output

I have been trying to solve the following system of delay differential equations using JiTCDDE:

Model equations

And this is my code:

from jitcdde import y, t
from jitcdde import jitcdde
import matplotlib.pyplot as plt
import numpy as np
from pylab import *

N1=30290000
a1=0.98*N1
eps=1/5
b1=0.000024246
eta=0.3
B1=0.7
m=0.0005
chi=0.071 
k1=0.185
alpha1=0.1155 
delta=0.0225 
phi1=0.26
omega1=0.26
d=3

model=[b1-((y(0)*B1*(y(2)+y(3)+(eta*y(5))))/a1)-b1*y(0)-m*y(0,t-d),
       ((y(0)*B1*(y(2)+y(3)+(eta*y(5))))/a1)-(k1+eps)*y(1)-m*y(1,t-d), 
       k1*eps*y(1)-(alpha1+chi)*y(2)-m*y(2,t-d),
       (1-k1)*eps*y(1)-(phi1+omega1)*y(3)-m*y(3,t-d),
       k1*y(1)+alpha1*y(2)-chi*y(4),
       (phi1+omega1)*y(3)-(chi+delta)*y(5),
       chi*(y(4)+y(5))-b1*y(6)-m*y(6,t-d),
       delta*y(5)]

I=jitcdde(model)
I.constant_past([(0.98*N1-13),0,5,7,0,1,0,0], time=0.0)
I.step_on_discontinuities()
e=[]
for i in range(50):
    e.append(I.integrate(i)[1])
print(e)

The problem is, for the second array of the solution (which I am trying to access), the first few values are negative values when I have specified that for t<0, the value is is 0. I have tried out this same model using ddeint and it gives a monotonically increasing curve with positive values, which is what I expect. I want jitcdde to work though, since this model should run even when there is no delay term. The first array seems fine and I have checked my model to see if I had made any typos but everything looks good to me. I have also tried using adjust_diff and integrate_blindly, but the issue remains.

Upvotes: 0

Views: 56

Answers (0)

Related Questions