Re: NDSolve w/ vectors requires homogenous system in 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg42823] Re: NDSolve w/ vectors requires homogenous system in 5.0
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 30 Jul 2003 04:08:00 -0400 (EDT)
- Organization: The University of Western Australia
- References: <bftef5$60b$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bftef5$60b$1 at smc.vnet.net>,
dalefamily at yahoo.com (Brian Dale) wrote:
> It seems that the NDSolve portion works fine, but that the functions
> such as Cross and Plus have trouble working correctly with the
> required mix of numeric and symbolic vectors. The effect of this is
> to restrict vector diff eqts to homogenous systems. Here are my
> results:
>
> The Bloch equation (fundamental equation for magnetic resonance
> imaging) describes the motion of an isochromat in a magnetic field.
> For all parameters = 1 (for simplicity) I can define the following:
>
> b = {1,1,0} represents the magnetic field
> d = DiagonalMatrix[{1,1,1}] represents the signal decay
> r = {0,0,1} represents the signal regrowth
> bd = {{-1,0,-1},{0,-1,1},{1,-1,-1}} represents field and decay
> bdr = {{-1,0,-1,0},{0,-1,1,0},{1,-1,-1,1},{0,0,0,0}} represents
> everything for the augmented coordinate system {x,y,z,Mo}
>
> m0 = {0,0,1} initial magnetization
> ma0 = {0,0,1,1} augmented initial magnetization
>
> The Bloch equation can be written in 3 ways:
>
> eq1:= {m'[t] == Cross[m[t],b] - d.m[t] + r , m[0] == m0}
> eq2:= {m'[t] == bd.m[t] + r , m[0] == m0}
> eq3:= {ma'[t] == bdr.ma[t] , ma[0] == ma0}
>
> NDSolve[eq1, m, {t,0,10}] generates the message Cross::nonn1
> (arguments should be equal-length vectors) and the message
> NDSolve::ndfdmc (inconsistent dimensionality) and fails.
If you introduce
m[t_] = {m1[t], m2[t], m3[t]};
Then you can use
NDSolve[Thread /@ eq1, m[t], {t, 0, 10}]
(Thread turns the equations into a list of equations) and plot the
solution as follows.
Plot[Evaluate[m[t] /. %], {t, 0, 10}];
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