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


Groups > comp.soft-sys.math.mathematica > #9956

Re: NDSolve in 3D

From Nicholas <physnick@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: NDSolve in 3D
Date 2012-05-04 10:27 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jo0aus$cak$1@smc.vnet.net> (permalink)
References <jnim4q$alk$1@smc.vnet.net>

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web