Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

desolve_system_rk4 lisp debugger

I am attempting to solve a system of 3 differential equations. Whenever I set the initial condition of the third variable not equal to 0, I get a lisp debugger error message. I have posted the code and the error message below. I should note that it runs as long as the initial condition of the third variable is equal to 0.

a,b,c,t=var('a, b, c, t')

Parameter Values

r_a=1.09 r_b=1.1 k=500 alpha_a=0.11 alpha_b=0.11 beta_a=0.2 beta_b=0.2 d=0.5

Differential Equations

aprime=r_aa(1-((a+alpha_ab)/k))-beta_aca bprime=r_bb(1-((b+alpha_ba)/k))-beta_bcb cprime=beta_bcb+beta_aca-dc

Variables

variables=[a,b,c]

Initial Conditions (t0,a0,b0,c0)

ic=[0,200,200,50]

tfinal

tfinal=100

P=desolve_system_rk4([aprime,bprime,cprime],variables,ics=ic,ivar=t,end_points=tfinal)

Adata=[ [i,j] for i,j,k,l in P] Aplot=list_plot(Adata,color='red')

Bdata=[ [i,k] for i,j,k,l in P] Bplot=list_plot(Bdata,color='blue')

Cdata=[ [i,l] for i,j,k,l in P] Cplot=list_plot(Cdata,color='purple')

Aplot+Bplot+Cplot


To enable the Lisp debugger set debugger-hook to nil.

desolve_system_rk4 lisp debugger

I am attempting to solve a system of 3 differential equations. Whenever I set the initial condition of the third variable not equal to 0, I get a lisp debugger error message. I have posted the code and the error message below. I should note that it runs as long as the initial condition of the third variable is equal to 0.

a,b,c,t=var('a, b, c, t')

t')

Parameter Values

#Parameter Values r_a=1.09 r_b=1.1 k=500 alpha_a=0.11 alpha_b=0.11 beta_a=0.2 beta_b=0.2 d=0.5

d=0.5

Differential Equations

#Differential Equations aprime=r_a*a*(1-((a+alpha_a*b)/k))-beta_a*c*a bprime=r_b*b*(1-((b+alpha_b*a)/k))-beta_b*c*b cprime=beta_b*c*b+beta_a*c*a*-d*c #Variables variables=[a,b,c]

aprime=r_aa(1-((a+alpha_ab)/k))-beta_aca bprime=r_bb(1-((b+alpha_ba)/k))-beta_bcb cprime=beta_bcb+beta_aca-dc

#Initial Conditions (t0,a0,b0,c0) ic=[0,200,200,50] #tfinal tfinal=100

Variables

P=desolve_system_rk4([aprime,bprime,cprime],variables,ics=ic,ivar=t,end_points=tfinal)

variables=[a,b,c]

Initial Conditions (t0,a0,b0,c0)

ic=[0,200,200,50]

tfinal

tfinal=100

P=desolve_system_rk4([aprime,bprime,cprime],variables,ics=ic,ivar=t,end_points=tfinal)

Adata=[ [i,j] for i,j,k,l in P] Aplot=list_plot(Adata,color='red')

Aplot=list_plot(Adata,color='red')

Bdata=[ [i,k] for i,j,k,l in P] Bplot=list_plot(Bdata,color='blue')

Bplot=list_plot(Bdata,color='blue')

Cdata=[ [i,l] for i,j,k,l in P] Cplot=list_plot(Cdata,color='purple')

Cplot=list_plot(Cdata,color='purple')

Aplot+Bplot+Cplot

Aplot+Bplot+Cplot

To enable the Lisp debugger set debugger-hook to nil.