Ask Your Question

lucamollica's profile - activity

2022-11-28 09:35:36 +0100 received badge  Notable Question (source)
2021-01-25 18:28:41 +0100 received badge  Popular Question (source)
2017-03-01 07:30:16 +0100 received badge  Organizer (source)
2017-02-28 17:02:00 +0100 received badge  Editor (source)
2017-02-28 16:52:52 +0100 asked a question Differential equations system solving with boundaries

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)
var('sola,solb,solc,sold,sole,solg')
sola=f[0].rhs()
solb=f[1].rhs() 
solc=f[2].rhs()  
sold=f[3].rhs() 
sole=f[4].rhs()
solg=f[5].rhs()

............................................

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.

Luca