Skip to content

Instantly share code, notes, and snippets.

@teeGraco
Created June 18, 2018 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teeGraco/14ef236e8c8d6514b34eebb72d45eaf0 to your computer and use it in GitHub Desktop.
Save teeGraco/14ef236e8c8d6514b34eebb72d45eaf0 to your computer and use it in GitHub Desktop.
StateVector NumInt(StateVector S, StateVector S_dot, float h, float t, StateVector F())
{
StateVector K1, K2, K3, K4
StateVector S_new
K1 = S_dot
K2 = F(S + h/2 + K1, t + h/2)
K3 = F(S + h/2 + K2, t + h/2)
K4 = F(S + h + K3, t + h)
S_new = S + h/6 * (K1 + 2*K2 + 2*K3 + K4)
return S_new
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment