[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lsode for matrix DGLs?
From: |
Matthias Brennwald |
Subject: |
Re: lsode for matrix DGLs? |
Date: |
Fri, 22 Jun 2007 22:14:57 +0200 |
On 22.06.2007, at 21:19, John W. Eaton wrote:
On 22-Jun-2007, Matthias Brennwald wrote:
| I guess
| Johns approach of reshaping my matrices to vectors should do the
trick.
Only if you have T as a scalar and the dimension of the vector
returned by F is the same as the dimension of the state variable X.
I don't recall ever encountering a differential equation in which the
independent variable (T) is a vector. Can you give us some more
detail about the problem you are trying to solve? How does T enter
the problem?
jwe
Ok, here's what I'm thinking about: I have a model consisting of N
boxes ('compartments' or 'reservoirs') filled with water. The water
in each box contains M solvents. The boxes are connected to each
other by a network of pipes, and water can flow from one box to
another through this network, therefore exchanging solvents between
the boxes. Furhtermore, the solvents are radioactive. For instance,
if a solvent A decays to solvent B, I'll have to consider the
decrease in the concentration of A and the corresponding increase in
the concentration of B.
So, I thought I'd set up my variables as follows:
- t is time
- C(i,j) is the concentration of solvent i in box j (i=1...M,
j=1...N). This is a function of time t.
- F(k,l) is the water flux from box k to box l (k, l = 1...N, with
the diagonal elements zero).
- R(u,v) the production rate of solvent v from the radioactive decay
of u (u,v = 1...M, with R(u,v) <= 0 for u=v and R(u,v) >= 0 for u != v).
So, t is a scalar, and C, F and R are matrices.
With these variables, it should be possible to write down a
differential equation for C that completely describes the dynamics of
the solutes in the different boxes. dC/dt is then a matrix, too.
In Octave, the time steps will be stored in a vector. If the length
of this vector is P, the solution of the differential equation will
consist of P matrices of size M x N, i.e. a M x N x P array.
Matthias
-------
Matthias Brennwald
Lägernstrasse 6
CH 8037 Zürich
+41 (0)44 364 17 03
address@hidden