Mathematica: NDSolve in 3 dimensions

Click For Summary
SUMMARY

The discussion focuses on solving Newton's equations for a particle in three dimensions using Mathematica's NDSolve function. The initial attempt involved defining the equations of motion for x, y, and z coordinates, but the resulting plot was empty. The user, Niles, identified an error in the variable specification and corrected the initial values, which resolved the plotting issue. The final solution successfully visualizes the motion of the particle under the specified conditions.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of Newton's laws of motion
  • Knowledge of differential equations and initial value problems
  • Experience with Mathematica's NDSolve function
NEXT STEPS
  • Explore advanced features of NDSolve in Mathematica
  • Learn about visualizing 3D motion using Mathematica's Graphics3D
  • Study the effects of varying initial conditions on particle trajectories
  • Investigate numerical methods for solving differential equations
USEFUL FOR

Mathematica users, physicists, and engineers interested in simulating and visualizing particle dynamics in three-dimensional space.

Niles
Messages
1,834
Reaction score
0
Hi

I am trying to solve Newtons equation for a particle in (x, y, z) using NDsolve. Here I what I have so far:

Code:
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] == 2, x'[0] == 0, y[0] == 0, y'[0] == 0, z[0] == 0, 
    z'[0] == 250},
   {x[t], y[t], z[t]}, {t, 0, 1}];

ParametricPlot[{x[t], x'[t]} /. sol, {t, 0, 0.001}, PlotRange -> {{0, 0.35}, {0, 5}}, AspectRatio -> 0.75]
The force acting on the particle only affects (x, y), not z. However, my plot is empty.

Is my use of NDsolve correct?


Niles.
 
Physics news on Phys.org
I found one error. It should be {x, y, z}, not {x[t], y[t], z[t]}. However, the parametric plot still doesn't work.
 
It works now, there was a problem with my IV. Just had to pick a correct value.Niles.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K