Physics/math problem - how to get from one position+velocity to another
July 17, 2018 5:40 PM   Subscribe

I've got a problem I've been chewing on, and have it partly figured out, but haven't managed to distill it into a form I could, for example, code into a video game. Basically, if I have a starting position and velocity, and want to have a particular ending position and velocity after a given time, what movement accomplishes that with the smallest peak acceleration? I feel like this is probably a solved problem, but I don't know how to search for the topic effectively.

Things I think I've figured out:
- the 1-dimensional solution involves an acceleration of constant magnitude that changes direction at most once
- solving the 1-dimensional case is sufficient for generalizing to multiple dimensions (because each dimension can be solved independently, and combined)
- the problem can be simplified by setting the starting position and velocity to 0 and transforming the other parameters accordingly
posted by NMcCoy to Science & Nature (10 answers total) 5 users marked this as a favorite
 
You're correct about the dimensions.

If you don't want to get in to the whole minimizing functionals thing, one simpler strategy is to assume your equation of motion is a polynomial in time.

Let your initial position be x0, initial velocity v0, final position x1, final velocity v1.

For example, if we wanted a fourth degree approximation, let x(t) = a*t^4 + b*t^3 + c*t^2 + v0*t + x0 (this satisfies the initial conditions). Substitute your final time to get another set of equations. You will end up with an underdetermined system (you will solve for a as a function of c and b as a function of c). Then you can choose c to minimize the maximum acceleration.

Use a higher degree polynomial for a better approximation.

The equations quickly get complex (but not unsolvable) so I highly recommend you get a computer algebra system to do this for you.
posted by dilaudid at 6:18 PM on July 17, 2018




Best answer: - the 1-dimensional solution involves an acceleration of constant magnitude that changes direction at most once

If you write out the position and velocity as a (piecewise) function of the magnitude k and the change time tchange, you can get two equations (for the ending velocity v1 and the ending position x1) in two unknowns (k and tchange). Then you can solve for k and tchange in terms of the ending velocity and position.
posted by panic at 6:58 PM on July 17, 2018 [2 favorites]


Best answer: While they do not necessarily satisfy your desire for a mathematical guarantee of minimum peak acceleration, cubic Hermite splines are such an easy answer I have to mention them, as they’re specified in terms of beginning and ending positions and velocities, they tend to produce sane and pleasing interpolations for many applications, and they have a nice closed-form definition that’s easy to implement.
posted by musicinmybrain at 8:07 PM on July 17, 2018 [5 favorites]


Are you old enough to remember gorillas.bas? The code should be easy to find, and you might enjoy it.
posted by theora55 at 9:34 PM on July 17, 2018 [1 favorite]


The mathematical technique you want is called the calculus of variations. It can be used for generating a function that minimizes some quantity. If that quantity is "action", you can generate a kinematic path that satisfies the principle of least action. If it is something else, like surface energy, you can solve for things like the shape of a meniscus.
posted by Maxwell's demon at 9:48 PM on July 17, 2018 [1 favorite]


The problem is, this method will give you a differential equation with the two end points as boundary conditions. It might not have an analytical solution, but you can integrate it numerically.
posted by Maxwell's demon at 9:51 PM on July 17, 2018


Reading your question better, I think your solution is correct. Minimizing peak acceleration means finding a constant magnitude acceleration that matches the boundary conditions. The other methods would be better for generating shorter or smoother paths.
posted by Maxwell's demon at 11:39 PM on July 17, 2018


Response by poster: Cubic Hermite splines look like they'll generally give me what I want in practical terms, perhaps moreso than what I assumed I'd want. In particular, the fact that you can assemble them from a linear combination of basis functions looks like it'll make implementing/testing them super easy.

The math hint offered by panic above also looks like the clue I was missing for solving my problem as stated. I'll have to try both of these approaches out and see how they look in practice!

(Also, I basically taught myself how to program by editing gorillas.bas, so it's personally relevant to me even if it doesn't contain the specific answer to my question.)
posted by NMcCoy at 2:35 AM on July 18, 2018 [1 favorite]


I know nothing about any of this but just wanted to make sure that you want "normal" movement in cartesian space and not orbital movement which is Different and where the ways to get from Here to There can be [technical] weird and pissed-off. [/technical]
posted by GCU Sweet and Full of Grace at 6:05 AM on July 18, 2018 [1 favorite]


« Older How to add a date stamp to a series of video files...   |   Vegan dessert for a birthday party Newer »
This thread is closed to new comments.