Re: Systems of ODEs
- To: mathgroup at smc.vnet.net
- Subject: [mg42163] Re: Systems of ODEs
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 21 Jun 2003 02:49:39 -0400 (EDT)
- Organization: The University of Western Australia
- References: <bcmpdi$spk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bcmpdi$spk$1 at smc.vnet.net>, PAUL ANDREW ELLISON <paellison at wisc.edu> wrote: > However, when the system is complicated by adding equations and difficulty to > the symbolic coefficients, the calculation takes an extreme amount of time > (Calculation was let run for about 70 hours without crashing on a 1.8mHz P4 > with 512mb of RAM until i stopped the calculation). The system that caused > this long of a calculation was as follows: > > Simplify[DSolve[{P'[t]==k1 A[t]+k2 B[t]+k3 C[t],A'[t]==(-k1-k12) A[t]+k21 > B[t],B'[t]==(-k2-k21-k23) B[t]+k12 A[t]+k32 C[t],C'[t]==(-k3-k32) C[t]+k23 > B[t],P[0]==0,A[0]==A0,B[0]==B0,C[0]==C0},{P[t],A[t],B[t],C[t]},t]] > > Is there some trick to making such complicated systems solve without having > to devote an entire weeks worth of computer time to it? Will Self pointed out that your problem involves computing the roots of a 4th order (really 3rd order) polynomial with symbolic coefficients. And Selwyn Hollis pointed out that you could use MatrixExp to solve the system of differential equations. First, note that your equations, as a matrix system reads mat = {{0, k1, k2, k3}, {0, -k1 - k12, k21, 0}, {0, k12, -k2 - k21 - k23, k32}, {0, 0, k23, -k3 - k32}}; D[{p[t], a[t], b[t], c[t]},t]== mat . {p[t], a[t], b[t], c[t]} so you could use MatrixExp on mat. Second, note that you can stop Mathematica from trying to explicitly compute roots of cubics and quartics using SetOptions[Roots, Cubics -> False, Quartics -> False] After doing this you will see that Mathematica can compute MatrixExp[mat, t] without any problems in terms of Root objects -- which is the best that you can possibly hope for. One advantage of this representation is that analytical properties of the solutions can be studied. Cheers, Paul -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul