Re: NDSolve and vector functions

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

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. r[t_]={x[t],y[t]} 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, etc.},r[t],{t,0,10}] and the above Thread-ing will do just that. Kevin 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 JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250