Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: NDSolve with functions of vectors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82884] Re: NDSolve with functions of vectors
  • From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
  • Date: Fri, 2 Nov 2007 03:30:38 -0500 (EST)
  • References: <fgca49$9ho$1@smc.vnet.net>

This does what you want:

solution =
 NDSolve[{x'[s] == {2*x[s][[2]], x[s][[1]]/3, x[s][[3]]},
   x[0] == {1, 1, 1}}, x[s], {s, 0, 1}]

gives

{{x[s]->InterpolatingFunction[{{0.,1.}},<>][s]}}

Then

ParametricPlot3D[Expand[x[s]/.solution[[1]]],{s,0,1}]

gives a 3D plot of the trajectory for 0<=s<=1.

-- 
Steve Luttrell
West Malvern, UK

"John Lee" <johnlee_15 at hotmail.com> wrote in message 
news:fgca49$9ho$1 at smc.vnet.net...
> 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.
>
> Any advice would be helpful. Thanks,
> John
> 



  • Prev by Date: Re: Re: Setting Negatives to Zero
  • Next by Date: Re: NDSolve with functions of vectors
  • Previous by thread: Re: NDSolve with functions of vectors
  • Next by thread: Re: NDSolve with functions of vectors