Skip to content

Commit

Permalink
use lowercase method names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Stephens committed Dec 30, 2014
1 parent 8ee0d59 commit 5493ffe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions lib/kepler/lagrange.rb
Expand Up @@ -6,19 +6,19 @@ class << self
include Stumpff

def f(x, z, r)
1 - ((x ** 2) / r.magnitude) * C(z)
1 - ((x ** 2) / r.magnitude) * c(z)
end

def g(x, z, dt)
dt - ((1 / Math.sqrt(MU)) * (x ** 3) * S(z))
dt - ((1 / Math.sqrt(MU)) * (x ** 3) * s(z))
end

def df(x, z, r, r0)
(Math.sqrt(MU) / (r.magnitude * r0.magnitude)) * (S(z) * z - 1) * x
(Math.sqrt(MU) / (r.magnitude * r0.magnitude)) * (s(z) * z - 1) * x
end

def dg(x, z, r)
(1 - (((x ** 2) / r.magnitude) * C(z)))
(1 - (((x ** 2) / r.magnitude) * c(z)))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/kepler/orbit.rb
Expand Up @@ -113,7 +113,7 @@ def universal_anomaly(dt)

def update!(dt)
x = universal_anomaly(dt)
z = UniversalFormulation.Z(x, a)
z = UniversalFormulation.z(x, a)
r0 = @r
v0 = @v

Expand Down
4 changes: 2 additions & 2 deletions lib/kepler/stumpff.rb
@@ -1,6 +1,6 @@
module Kepler
module Stumpff
def C(z)
def c(z)
if z > 0
(1 - Math.cos(Math.sqrt(z))) / z
elsif z < 0
Expand All @@ -10,7 +10,7 @@ def C(z)
end
end

def S(z)
def s(z)
if z > 0
(Math.sqrt(z) - Math.sin(Math.sqrt(z))) / (Math.sqrt(z) ** 3)
elsif z < 0
Expand Down
20 changes: 10 additions & 10 deletions lib/kepler/universal_formulation.rb
Expand Up @@ -6,14 +6,14 @@ module UniversalFormulation
class << self
include Stumpff

def Z(x, a)
def z(x, a)
(x ** 2) / a
end

def f(x, a, r, v, dt)
z = Z(x, a)
s = S(z)
c = C(z)
z = z(x, a)
s = s(z)
c = c(z)

((1 - (r.magnitude / a)) * s * (x ** 3)) +
((r.inner_product(v) / Math.sqrt(MU)) * c * (x ** 2)) +
Expand All @@ -22,19 +22,19 @@ def f(x, a, r, v, dt)
end

def dfdt(x, a, r, v)
z = Z(x, a)
s = S(z)
c = C(z)
z = z(x, a)
s = s(z)
c = c(z)

(c * (x ** 2)) +
((r.inner_product(v) / Math.sqrt(MU)) * (1 - (s * z)) * x) +
(r.magnitude * (1 - (c * z)))
end

def d2fdt(x, a, r, v)
z = Z(x, a)
s = S(z)
c = C(z)
z = z(x, a)
s = s(z)
c = c(z)

((1 - (r.magnitude / a)) * (1 - (s * z)) * x) +
((r.inner_product(v) / Math.sqrt(MU)) * (1 - (c * z)))
Expand Down

0 comments on commit 5493ffe

Please sign in to comment.