Numerically Integrating Equation of Motion for an Object

Click For Summary

Discussion Overview

The discussion revolves around numerically integrating the equations of motion for an object, particularly focusing on the conversion of a second-order vector differential equation into first-order ordinary differential equations (ODEs). Participants explore various numerical methods and their applicability to different scenarios, including the effects of drag force and gravity.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • Some participants assert that the second-order vector differential equation can be expressed as a system of two first-order vector equations, leading to four first-order scalar equations in two dimensions.
  • Others clarify that for a 2D problem, the combined position and velocity vector can be represented as a four-dimensional vector, allowing for numerical integration using first-order ODE techniques.
  • One participant emphasizes the importance of considering the geometry of the problem when choosing numerical methods, suggesting that second-order ODE solvers may yield better results than first-order methods.
  • Another participant recommends the Velocity Verlet algorithm for practical integration of equations of motion, citing its stability and effectiveness for typical interactions, while noting its limitations in gravity-related problems.
  • Concerns are raised about the performance of explicit methods like the Euler method in conserving physical quantities, with suggestions for more advanced techniques such as leapfrog or Verlet integrators.
  • One participant mentions that while Verlet methods work well for many scenarios, they may not be suitable for complex gravitational simulations, advocating for implicit methods in those cases.

Areas of Agreement / Disagreement

Participants express differing views on the best numerical methods for integrating equations of motion, with some advocating for specific techniques while others highlight their limitations. There is no consensus on a single best approach, as various methods are proposed for different contexts.

Contextual Notes

Participants note that the choice of numerical method may depend on the specific characteristics of the problem, such as dimensionality and the forces involved. Limitations of certain methods in specific scenarios, particularly in gravitational simulations, are acknowledged.

The_Engineer
Messages
17
Reaction score
0
I'm trying to integrate the equations of motion for a object.

F + mg = ma

where F is the drag force, g gravity, a is acceleration, etc...

I'm trying to do it numerically and I'm confused about one thing:

Since this is a 2nd order vector differential equation, should it be equivalent to a system of two 1st order ODEs or four 1st order ODEs?
 
Physics news on Phys.org
It is a system of two 1st order vector equations. if you call the unknown variables x and v (position and velocity vectors), a = dv/dt, so your equation becomes

dv/dt = F/m + g

and the other equation is just

dx/dt = v

Iif the motion is in two dimensions, the vectors x and v will each have two components, and you need to resolve F and g into their components as well, so in a sense you end up with four 1st order scalar equations.
 
Welcome to PF!

You will get one (simple) ODE for each dimension in your position state, and one ODE for each dimension in the velocity state. So, for a 2D problem you'd have 4 scalar ODE's, and in 3D you'd have 6.
 
AlephZero said:
It is a system of two 1st order vector equations. if you call the unknown variables x and v (position and velocity vectors), a = dv/dt, so your equation becomes

dv/dt = F/m + g

and the other equation is just

dx/dt = v

Iif the motion is in two dimensions, the vectors x and v will each have two components, and you need to resolve F and g into their components as well, so in a sense you end up with four 1st order scalar equations.

Thank you that was very informative. If I would like to include an initial angle (from where the projectile is taking off) in my simulation, should I convert to polar coordinates?
 
The_Engineer said:
Thank you that was very informative. If I would like to include an initial angle (from where the projectile is taking off) in my simulation, should I convert to polar coordinates?

I just realized that the initial velocity vector is the same thing as the initial angle. Nevermind and thank you!
 
The_Engineer said:
Since this is a 2nd order vector differential equation, should it be equivalent to a system of two 1st order ODEs or four 1st order ODEs?
In theory, the answer is yes. In practice, when using numerical techniques, the answer is a resounding no.

Here's the theory. Create a phase vector that contains the position and velocity vectors. This new vector contains 2N elements, where N is the dimensionality of the space. For your 2D problem, this combined position+velocity vector is ##\vec u = [x,y,\dot x, \dot y]##. The derivative of this 4-vector is another 4-vector: ##\dot{\vec u} = [\dot x, \dot y, \ddot x, \ddot y]##. You already know the first two elements, and you also know the next two via ##F=ma## (presumably you know the net force).

You have a 4-vector and you a way to calculate its derivative, so just use your favorite numerical first order ODE technique to integrate. Easy!

Not so easy. The problem is that this approach ignores the geometry of the problem. If you can find a 2nd order ODE solver that is of the same degree as that 1st order ODE solver, the 2nd order technique is almost always going to be better because it pays at least some attention to the geometry.

A simple example: The simplest 1st order ODE technique is the explicit Euler method for 1st order ODEs. A much improved (but still lousy) technique that pays attention to the 2nd order nature of F=ma is the symplectic Euler method. Explicit Euler doesn't conserve any of the conserved quantities (energy, angular momentum, and linear momentum). Symplectic Euler comes much closer to doing so.

Don't use either of the Euler methods. Symplectic Euler is lousy; explicit Euler is extremely lousy. You still need to understand the Euler methods because all but the most advanced techniques are variations on the Euler methods. A slight step up in complexity is the leapfrog / verlet family of integrators. Done right, these require only one computation of acceleration per time step, but the accuracy is vastly improved. There is no 1st order ODE equivalent to any of the leapfrog / verlet integrators.

You can do even better than this, but now things get complex. There is a problem with higher degree geometric integrators: They get hairy.
 
Let it make very simple for you. For most practical purposes, integrating EoM should be done using Velocity Verlet algorithm. Why? Because it's very simple, and it gives you second order method which happens to be extremely stable for most practically encountered interactions. In particular, it does extremely well with Hook's potential, which is what you'd typically use for collisions. (This method belongs to the family of methods D H mentions. I'm not disagreeing with him, just saying, go for this particular method. Velocity Verlet will make your life easier.)

Here is one notable exception to keep in mind. Verlet, as well as any other explicit Runge-Kutta method, is really pants at doing gravity problems. I don't mean F + mg kind of gravity. That you can do with Verlet. I'm talking plotting space-ship trajectory through a solar system. If you ever need to do that level of simulation, Verlet will betray you. For problems involving gravity, when you need good precision, you have to use implicit methods. 2nd or 3rd order Gauss-Legendre should work much better for these kinds of problems, but that's a whole different level of complexity.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K