Mathematica: NDSolve in 3 dimensions

In summary, the conversation is about using NDsolve to solve Newton's equation for a particle in (x, y, z). The person is having trouble with their parametric plot and asks for help. It is discovered that there was an error in the code, specifically the use of {x[t], y[t], z[t]} instead of {x, y, z}, and the plot is now functioning correctly.
  • #1
Niles
1,866
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
  • #2
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.
 
  • #3
It works now, there was a problem with my IV. Just had to pick a correct value.Niles.
 

Related to Mathematica: NDSolve in 3 dimensions

1. How do I use NDSolve in 3 dimensions in Mathematica?

To use NDSolve in 3 dimensions in Mathematica, you can specify the domain of the problem using the RegionPlot3D function and then pass it as an argument to the NDSolve function. You can also specify the initial and boundary conditions for the variables in the problem.

2. Can NDSolve in 3 dimensions handle complex differential equations?

Yes, NDSolve in 3 dimensions can handle complex differential equations. You can specify the complex variables and equations in the NDSolve function and it will solve them accordingly.

3. How can I visualize the solutions obtained from NDSolve in 3 dimensions?

You can use the Plot3D function in Mathematica to visualize the solutions obtained from NDSolve in 3 dimensions. You can specify the variables and range of values to be plotted and it will generate a 3D plot of the solution.

4. Can NDSolve in 3 dimensions handle systems of differential equations?

Yes, NDSolve in 3 dimensions can handle systems of differential equations. You can specify multiple equations and variables in the NDSolve function and it will solve the system simultaneously.

5. Are there any limitations to using NDSolve in 3 dimensions in Mathematica?

There are some limitations to using NDSolve in 3 dimensions in Mathematica, such as the computational resources required for solving large and complex systems of equations. It is recommended to check the documentation for specific limitations and workarounds.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
170
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
292
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
78
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
952
Back
Top