MathGroup Archive 2008

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

Search the Archive

Re: NDSolve and vector functions

  • To: mathgroup at
  • Subject: [mg87866] Re: NDSolve and vector functions
  • From: "Kevin J. McCann" <Kevin.McCann at>
  • Date: Sat, 19 Apr 2008 03:32:19 -0400 (EDT)
  • Organization: University System of Maryland
  • References: <fu9vl0$ie2$>

I don't believe this is possible. How would Mathematica "know" that p[t] 
is 2d, 3d, 4d, ...? When I have used something like your approach it is 
really for ease of the human user, e.g.

Then in NDSolve you might *like* to do something like this:

r''[t]==-k r[t]

But it won't work. You need to Thread the components:

Thread[r''[t]==-k r[t]]

to split out each of the two diff eqs. In the end NDSolve works on a 
single component of the de; so, it really needs something like:

NDSolve[{x''[t]==-k x[t],y''[t]==-k y[t],x[0]==1,x'[0]==2, 

and the above Thread-ing will do just that.


dh wrote:
> Hello all,
> does anybody know a way to compute a vector valued function using 
> NDSolve without explicitely specifying all vector components. Here is a 
> simple example: Although NDSolve[{p'[t]==p[t],p[0]=={1,0}},p,{t,0,1}] works,
> NDSolve[{p'[t]==p[t]+{1,1},p[0]=={1,0}},p,{t,0,1}]
> does not work because p[t] in "p[t]+{1,1}"  is treated as a scalar and 
> the expression is evaluated to {1+p[t],1+p[t]} what is clearly not 
> intended. Even in "IdentityMatrix[2].p[t]+{1,1}" 
> "IdentityMatrix[2].p[t]" is treated like a scalar and added to the 
> components of {1,1}.
> do I miss something???
> Daniel


Kevin J. McCann
Research Associate Professor
Physics Building
University of Maryland, Baltimore County
1000 Hilltop Circle
Baltimore, MD 21250

  • Prev by Date: Re: Re: Abs[x] function
  • Next by Date: Re: NDSolve and vector functions
  • Previous by thread: Re: NDSolve and vector functions
  • Next by thread: Re: NDSolve and vector functions