Differential equations system solving with boundaries

asked 2017-02-28 16:35:18 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Dear all,

being a newbie in the practice of Sage I hope this question won't be silly, but unfortunately I cannot find anything helpful in the the forum neither in the documentation. I am handling a system of 6 differential equations as follows, using desolve_system:


var ('t a b c d e g')

a = function('a')(t)
b = function('b')(t) 
c = function('c')(t) 
d = function('d')(t) 
e = function('e')(t) 
g = function('g')(t)  

dea = diff(a,t) == -10*a + 2*b + 3*c + 3*d + 2*e + 5*g
deb = diff(b,t) == -9*b + e 
dec = diff(c,t) == -9*c + d + e 
ded = diff(d,t) == -9*d + 2*a + 2*b + 2*c + 3*e + 2*g 
dee = diff(e,t) == -10*e 
deg = diff(g,t) == -9*g + 9*a + 2*b + 3*c + 3*d + 3*e 

sol = desolve_system([dea, deb, dec, ded, dee, deg], [a,b,c,d,e,g], ics=[0,1,1,1,1,1,1])

f(t,a,b,c,d,e,g) = sol
f = f(t)


The thing goes fine and solutions are provided. However, I need and extra boundary condition which is necessary for properly solving the problem (which is related to chemical kinetics, BTW, hence some conditions are mandatory for heading to a physical meaning of the solutions), i.e.:

a + b + c + d + e + g == 6

However, I cannot understand from the on line manual and its examples how to handle this condition, but I am only able to impose the initial conditions a0 = 1, b0 = 1 etc ... Could anyone suggest a possible solution to my problem and/or the good syntax for imposing such conditions to my equations?

Thanks in advance.


edit retag flag offensive close merge delete


but this is a DAE, right? I'm not sure if desolvers can handle those ones. Maybe relevant: PySDTool, see also SciPy's topical software page.

mforets gravatar imagemforets ( 2017-03-01 12:26:28 +0200 )edit