Mathematica Solve 2D Particle Motion: NDSolve with Non-Constant Deceleration in Mathematica

  • Thread starter Thread starter Niles
  • Start date Start date
  • Tags Tags
    2d Mathematica
AI Thread Summary
The discussion revolves around using Mathematica's NDSolve to model a particle's motion under specific conditions. Initially, a simple 1D equation of motion is successfully solved, where the particle experiences constant deceleration. The user then seeks to extend this model to include non-constant deceleration dependent on both x and y coordinates, leading to a system of differential equations. The proposed equations include a second derivative for x that incorporates the y-coordinate and a first derivative for y with a constant velocity. The user also raises a concern about implementing a boundary condition where the particle cannot exceed a y-coordinate of 5, as any movement beyond this point renders the solution irrelevant. The discussion highlights the capabilities of NDSolve in handling complex systems and the potential need for additional constraints to manage the particle's behavior effectively.
Niles
Messages
1,834
Reaction score
0
Hi

I am succesfully using NDSolve to find the solution of a 1D equation of motion:
Code:
solution = NDSolve[{x''[t] == -200, x[0] == 0, x'[0] == 100}, x, {t, 0, 1}];
ParametricPlot[{x[t], x'[t]} /. solution, {t, 0, 1}, PlotRange -> {{0, 100}, {0, 100}}]
This is a particle decelerating constantly in the x-direction. Now, I need to extend my problem, because the deceleration along x is actually not constant. It depends on both the x- and y-coordinate of the particle.

So the total problem is
<br /> \frac{d^2x}{dt^2} = -200y - x\\<br /> \frac{dy}{dt} = -2<br />
So along x there is non-constant deceleration, and along y I have a constant velocity. Is it possible to solve such a problem in Mathematica?

Best regards and thanks in advance,
Niles.
 
Last edited:
Physics news on Phys.org
Sure:

Code:
solution = 
 NDSolve[{x''[t] == -200 y[t] - x[t], y'[t] == -2, x[0] == 0, 
   x'[0] == 100, y[0] == 0}, {x[t], y[t]}, {t, 0, 1}]
 
Thanks, that is kind of you. NDSolve is a pretty powerful tool.

The initial condition y'(0) is something that changes for different problems. However, my particle is not allowed to move further than y=5. If it does so, then it is "lost", and its solution is not relevant to my problem any longer. Is there a way to incorporate this into NDSolve, i.e. that it should stop calculating further if y(t) == 5?Niles.
 

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
Replies
6
Views
2K
Replies
3
Views
5K
Replies
1
Views
4K
Replies
3
Views
8K
Replies
3
Views
2K
Replies
3
Views
3K
Back
Top