Jump to content
  • Advertisement
Sign in to follow this  
Narf the Mouse

Runge-Kutta - That funny-looking symbol that looks like an 'f'...

This topic is 3336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
F stands for a two variable function f(t,y) which seems to return the slope (aka derivative) of y at time t (http://upload.wikimedia.org/math/7/3/6/73654ee739d62e6612a2357db9d044f6.png). I wouldn't know since I've got near the same level of knowledge as you.

I actually gave up on RK4 since I got charmed by the speed an simplicity of simplectic integrators such as Velocity Verlet. However, if you need help getting actual code, here's Gaffer on the subject: http://gafferongames.com/game-physics/integration-basics/

Share this post


Link to post
Share on other sites
Would this, then, be a generic Runge-Kutta?


public static double RungeKutta4(double a, double b, double increment, double interval)
{
double h = increment * interval;
double k1 = h * MathExt.Lerp(a, b, interval);
double k2 = h * MathExt.Lerp(a + h / 2, b + k1 / 2, interval);
double k3 = h * MathExt.Lerp(a + h / 2, b + k2 / 2, interval);
double k4 = h * MathExt.Lerp(a + h, b + k3, interval);
return 1.0 / 6.0 * (k1 + k2 * 2 + k3 * 2 + k4);
}

Share this post


Link to post
Share on other sites
Quote:
Original post by Narf the Mouse
From this webpage

It's the only 'Funny looking symbol that looks like an 'f'' I saw when looking up Runge-Kutta. And yes, I did look it up on Wikipedia - Which is incredibly unhelpful with math, as it tends to be written for experts.

The Wikipedia page has the same information as the Mathworld page, plus a thorough description of the derivation. And it tells you what f is.
Quote:
Would this, then, be a generic Runge-Kutta?
No. How could it be? It doesn't even sample a provided function.

If memory serves, there is a generic RK4 integrator provided in Numerical Recipes in C, which should be available at any library with a reasonable CS collection.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!