MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica 6 and system of matrix and scalar ODEs in NDSolve:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83716] Re: Mathematica 6 and system of matrix and scalar ODEs in NDSolve:
  • From: Michael Schmidt <michaelschmidt.hd at googlemail.com>
  • Date: Thu, 29 Nov 2007 06:16:22 -0500 (EST)
  • References: <fijfp5$h73$1@smc.vnet.net>

Hi you all,

yesterday, I played a little bit more with NDSolve to find the problem. 
Here is another simpler example which shows what can go wrong. Can you 
please check whether you get the same results, as for me this looks like 
a bug in NDSolve?

sol1 and sol2 just work as they should do. Thus, there is no problem, if 
you only have matrices or scalars.

sol1 = NDSolve[{x'[t] == -x[t], y'[t] == -y[t], x[1] == 0.1,
    y[1] == 0.1}, {x, y}, {t, 1, 10}]
sol2 = NDSolve[{x'[t] == -x[t], y'[t] == -y[t],
    x[1] == 0.1 IdentityMatrix[2], y[1] == 0.1 IdentityMatrix[2]}, {x,
    y}, {t, 1, 10}]

However, as soon as you mix scalars and matrices, the matrix should not 
start with "y", "Y" or even "somelongfunnymodulename`Private`Y" :

sol3 = NDSolve[{y'[t] == -y[t], x'[t] == -x[t], y[1] == 0.1 ,
    x[1] == 0.1 IdentityMatrix[2]}, {y, x}, {t, 1, 10}]
sol4 = NDSolve[{x'[t] == -x[t], y'[t] == -y[t], x[1] == 0.1,
    y[1] == 0.1 IdentityMatrix[2]}, {x, y}, {t, 1, 10}]

sol3 just works fine. However, sol4 results in

NDSolve::nlnum: "The function value 
{-0.099924,{{-0.099924,0.},{0.,-0.099924}}} is not a list of numbers 
with dimensions {5} at {t,x[t],y[t]} = 
{1.00076,0.099924,{{0.099924,0.},{0.,0.099924}}}."

Best regards,

Michael




  • Prev by Date: Re: Create random binary images
  • Next by Date: Re: Convert nxn matrix to a column vector with (n^2) elements
  • Previous by thread: Derivative of function with indexed variables
  • Next by thread: Geocoding using Mathematica