Re: Re: NDSolve with functions of vectors
- To: mathgroup at smc.vnet.net
- Subject: [mg82910] Re: [mg82879] Re: NDSolve with functions of vectors
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Sat, 3 Nov 2007 03:23:27 -0500 (EST)
- References: <31565265.1194019878918.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
If I interpret your question properly...
Clear[x, y, z, a, u, arc, s, t]
a[t_] = {x[t], y[t], z[t]};
u[{x_, y_, z_}] = {2 y, x/3, z};
ds[{x_, y_, z_}] = Sqrt[#.#] &@u[{x, y, z}];
eqns = Thread[
Flatten@{a'[t] - u[a[t]], a[0] - {1, 1, 1}, arc'[t] - ds[a[t]],
arc[0]} == 0];
{x, y, z, arc} = {x, y, z, arc} /.
Last@NDSolve[eqns, {x, y, z, arc}, {t, 0, 6}];
The "arc" function is s in terms of t. To get x, y, and z in terms of s,
we invert the "arc" function:
Clear[si]
si = si /. First@
NDSolve[{si[arc[0]] == 0, si'[u] == 1/arc'[si@u]},
si, {u, arc@0, arc@6}];
Plot[si@arc[t], {t, 0, 6}]
Plot[arc@si[t], {t, arc@0, arc@6}]
Finally, here's a plot of x, y, and z in terms of arc length:
Plot[a[si[s]], {s, arc@0, arc@6}]
or
ParametricPlot3D[a[s], {s, arc@0, arc@6}]
Bobby
On Fri, 02 Nov 2007 03:28:04 -0500, John Lee <johnlee_15 at hotmail.com>
wrote:
> I'd like to clarify or make this question simpler:
>
> M0=NDSolve[{a'[s]==U[a[s]],a[0]==X},a,{s,0,6},Method->"ExplicitRungeKutta"]
>
> Where X = {1,0,0} and U = {f(x,y,z),g(x,y,z),h(x,y,z)}
>
> That does not work and I can't figure out why. The error I get is
> "Part::partw: Part 2 of a[s] does not exist." Same with "Part 3".
>
> -John
>
>
--
DrMajorBob at bigfoot.com