Skip to content

Instantly share code, notes, and snippets.

@Sgeo
Last active February 7, 2026 06:23
Show Gist options
  • Select an option

  • Save Sgeo/d095e6992ada8b3cdfb3b4b5473f9fbe to your computer and use it in GitHub Desktop.

Select an option

Save Sgeo/d095e6992ada8b3cdfb3b4b5473f9fbe to your computer and use it in GitHub Desktop.
gravity_actions_solved.txt
Previously derived approximation:
let r(t) be the distance from the GravityAction at time t.
let f(t) be the force of the GravityAction at time t.
r'(t) = -f(t)/r(t)
With help from HyperRogue Discord's off-topic channel:
dr/dt = -f(t)/r(t)
r(t) dr = -f(t) dt
∫ r(t) dr = ∫ -f(t) dt
r²(t)/2 = -F(t) + C (where F(t) is an antiderivative of f(t))
r(t) = ±√(-2F(t) + C)
For convenience I'll ignore negative r(t)
r(t) = √(-2F(t) + C)
Let r₀ = r(0)
r(0) = √(-2F(0) + C) = r₀;
-2F(0) + C = r₀²
C = r₀² + 2F(0)
r(t) = √(-2F(t) + r₀² + 2F(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment