This is a physics/calculus/computer science problem, but I think I'll get better results in the Physics SE.

I have a fun little project I've been working on (hobby, not homework/production), that models the flight of a projectile in various environments (2 Dimensional). Everything is nice and shiny with gravity and no air resistance. But of course, I've run into the classical Quadratic Air Resistance problem.

Now I have no problem with just accurately calculating various position: I have a 4th Order Runge-Kutta Method which works just fine for that. What I would like is, given an (x,y) coordinate pair, find the Required Angle needed to hit that coordinate, as well as the time needed to get there.

Currently I'm working on an algorithm that starts by finding two angles, one which overshoots, and another that undershoots, then using a binary search to narrow the range between them by plotting using the Runge-Kutta method, and increasing the stepsize until I've reached an acceptable accuracy.

Unfortunately I fear this will be much slower than I like, not to mention that one angle might overshoot one time, then when I increase the stepsize, could undershoot it, which would just make things crazier than I think they should be.

I've googled this quite a bit, but sadly couldn't find anything that, you know, helps. If you guys know of any algorithms that might be helpful, I would greatly appreciate it.

Even better would be a way to rework the Differential Equations to simplify the search, but sadly I am no where near good enough at Calculus for that to be a viable option.

Thanks, Jacob

  • $\begingroup$ scicomp.stackexchange.com may be a better fit. How long does your current computation take? $\endgroup$ – Kvothe Apr 10 '14 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.