From help-octave-request at bevo dot che dot wisc dot edu Thu Sep 27 15:00:19 2001 Subject: Re: System of ODE's From: Orsila Heikki To: Dennis Bayrock Date: Thu, 27 Sep 2001 22:31:59 +0300 (EET DST) On Wed, 26 Sep 2001, Dennis Bayrock wrote: > I am a research scientist involved in modeling yeast fermentations > for the production of alcohol. I have a system of ODE's to model and am > wondering if Octave is capable of handling such a system. For eg. > > dX/dt= 1+ dS/dt > dS/dt = -2.5 * dX/dt > dP/dt = 5 * dS/dt - 3 * dX/dt Well, that kind of trivial equation sets can be solved easily with little handwork.. Assume we have equation set: x1 = a10 + a11 * x1 + a12 * x2 + ... + a1n * xn x2 = a20 + a21 * x1 + a22 * x2 + ... + a2n * xn ... xn = an0 + an1 * x1 + an2 * x2 + ... + ann * xn Denote x = [x1,x2,...,xn]' and b=[a10,a20,...,an0]' And aij is item from matrix A row i column j.. We get equation: x = A*x + b => (I-A)*x = b => x = inv(I-A) * b = (say) = c Now we have that: x1 = c(1)*t + C1 x2 = c(1)*t + C2 ... xn = c(n)*t + Cn Parameters C1-Cn must be solved from initial-value information. Let that be vector C, then C = x(0). To apply this to your example problem: Let dX/dt = x1, dS/dt = x2 and dP/dt = x3 ... b=[1;0;0] A=[0,1,0;-2.5,0,0;-3,5,0] A = 0.00000 1.00000 0.00000 -2.50000 0.00000 0.00000 -3.00000 5.00000 0.00000 I=eye(3) c = inv(I-A)*b c = 0.28571 -0.71429 -4.42857 => X = x1 = 0.28571 * t + X(0) S = x2 = -0.71429 * t + S(0) P = x3 = -4.42857 * t + P(0) I don't have any experience with ODEs so if this is wrong, please tell me.. Heikki Orsila 32 bittiä - entä sitten? heikki dot orsila at tut dot fi http://www.pjoy.fi/lehdet/9212pj.htm http://www.ee.tut.fi/~orsila - Petteri Järvinen (1992) ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------