From f798e62c5590ecc87de8b50fbb1fc9f014bd78c7 Mon Sep 17 00:00:00 2001 From: Felix Tripier Date: Fri, 31 Aug 2018 17:32:47 -0700 Subject: [PATCH] More technically correct comment --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 753e807..d360f2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -117,8 +117,9 @@ function update(state: State) { let newAngularVelocity = oldAngularVelocity + gravitationalAcceleration * normalizedDt; - // because of floating point error, the energy of the system rises over time. - // this hopefully to corrects that over time. + // because of floating point error and because we don't evolve the system at fixed timesteps, + // the energy of the system rises over time. + // This corrects for these errors. const potentialEnergy = (gravity: number, mass: number, theta: number) => -gravity * mass * Math.cos(theta); const kineticEnergy = (mass: number, angularVelocity: number) =>