Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: NDSolve in 3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126371] Re: NDSolve in 3D
  • From: Nicholas <physnick at gmail.com>
  • Date: Fri, 4 May 2012 06:26:37 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jnim4q$alk$1@smc.vnet.net>

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... at 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.




  • Prev by Date: Re: Problem in using preassigned variable in manipulate
  • Next by Date: Re: Drawing on an image in Mathematica
  • Previous by thread: Re: Black box optimization
  • Next by thread: Re: Error function integral / Wolfram Function reference