Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9869 > unrolled thread

NDSolve in 3D

Started byNiles <niels.martinsen@gmail.com>
First post2012-04-29 06:12 +0000
Last post2012-05-04 10:27 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  NDSolve in 3D Niles <niels.martinsen@gmail.com> - 2012-04-29 06:12 +0000
    Re: NDSolve in 3D Nicholas <physnick@gmail.com> - 2012-05-04 10:27 +0000

#9869 — NDSolve in 3D

FromNiles <niels.martinsen@gmail.com>
Date2012-04-29 06:12 +0000
SubjectNDSolve in 3D
Message-ID<jnim4q$alk$1@smc.vnet.net>
Hi

I am trying to solve Newtons equation for a particle in (x, y, z), and here is what I have:

sol = NDSolve[{
    x''[t] == acceleration[x'[t], y[t], z[t]],
    y''[t] == acceleration[y'[t], x[t], z[t]],
    z''[t] == 0,
    x[0] == 0, x'[0] == 0, y[0] == 0, y'[0] == 0, z[0] == 0, 
    z'[0] == 250},
    {x[t], y[t], z[t]}, {t, 0, 1}];

There is only a force acting in the (x, y)-direction, and the z-component is just constant (not accelerating). When I plot the solution using

ParametricPlot[{x[t], x'[t]} /. sol, {t, 0, 0.001}, 
 PlotRange -> {{0, 0.35}, {0, 5}}, AspectRatio -> 0.75] 

the plot is empty. Is my syntax in NDSolve correct?


Best,
Niles.

[toc] | [next] | [standalone]


#9956

FromNicholas <physnick@gmail.com>
Date2012-05-04 10:27 +0000
Message-ID<jo0aus$cak$1@smc.vnet.net>
In reply to#9869
Niles,

There are a few issues :

First, without knowing the definition for the function 'acceleration'
I can't say anything specific, but if we choose

acceleration[a_, b_, c_] := a + b + c,

Then a correct syntax is

sol = NDSolve[{x''[t] == acceleration[x'[t], y[t], z[t]], y''[t] ==
acceleration[y'[t], x[t], z[t]], z''[t] == 0, x[0] == 0, x'[0] == 0,
y[0] == 0, y'[0] == 0, z[0] == 0, z'[0] == 250}, {x, y, z}, {t, 0, 1}];

Note that I do not use [t] when declaring the functions x,y, and z.

Then for the parametric plot, you need an Evaluate.

ParametricPlot[Evaluate[{x[t], x'[t]} /. sol], {t, 0, 1}, PlotRange ->
{{0, 0.35}, {0, 5}}, AspectRatio -> 0.75]

I changed your maximum time from 0.001 to 1.

Also, you may want to look into general theorems on systems of
autonomous coupled differential equations.

Hope this helps.

Nicholas.


On Apr 29, 2:12 am, Niles <niels.martin...@gmail.com> wrote:
> Hi
>
> I am trying to solve Newtons equation for a particle in (x, y, z), and here is what I have:
>
> sol = NDSolve[{
>     x''[t] == acceleration[x'[t], y[t], z[t]],
>     y''[t] == acceleration[y'[t], x[t], z[t]],
>     z''[t] == 0,
>     x[0] == 0, x'[0] == 0, y[0] == 0, y'[0] == 0, z[0] == 0,
>     z'[0] == 250},
>     {x[t], y[t], z[t]}, {t, 0, 1}];
>
> There is only a force acting in the (x, y)-direction, and the z-component is just constant (not accelerating). When I plot the solution using
>
> ParametricPlot[{x[t], x'[t]} /. sol, {t, 0, 0.001},
>  PlotRange -> {{0, 0.35}, {0, 5}}, AspectRatio -> 0.75]
>
> the plot is empty. Is my syntax in NDSolve correct?
>
> Best,
> Niles.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web