Re: NDSolve with functions of vectors

• To: mathgroup at smc.vnet.net
• Subject: [mg82873] Re: NDSolve with functions of vectors
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Fri, 2 Nov 2007 03:24:59 -0500 (EST)
• Organization: Uni Leipzig
• References: <fgca49\$9ho\$1@smc.vnet.net>

```Hi,
U[x_List] := {2*x[[2]], x[[1]]/3, x[[3]]}

X0 = {1, 1, 1};

and

sol = NDSolve[{a'[s] == U[a[s]], a[0] == X0}, a[s], {s, 0, 1}]

will do it. If yoy wish to use the path length you have to transform
a[s]== a[Sqrt[x[s]^2+y[s]^2+z[s]^2]].

Regards
Jens

ohn Lee wrote:
> Hi,
> I'm trying to integrate a function with NDSolve (ExplicitRungeKutta method), and it doesn't seem to recognize vector variables (I keep getting an incorrect dimension error). In addition, I would like to integrate over an absolute distance and I don't know how to do that in Mathematica. For simplicity's sake, I will post a random example of what I'm talking about:
> U[x] = {2*x[[2]],x[[1]]/3,x[[3]]} is the derivative
> X0 = {1,1,1} is the initial condition
> so if a'[s] = U[x[s]], I'd like to solve for a[s] where s is the total distance. And s is to be integrated from 0 to 6 with a[0]=X0.
> Ultimately, I have a derivative that depends on a 3-component position vector. I want to integrate that derivative over a total distance traveled from a starting point.
>