I THINK that the single shooter is ok. I can always improve it later

This commit is contained in:
rconnorjohnstone
2021-06-17 23:36:50 -06:00
parent 2c39c34f01
commit 966f954528
13 changed files with 170 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
function laguerre_conway(state::Vector{Float64}, μ::Float64, time::Float64)
function laguerre_conway(state::Vector{T}, μ::Float64, time::Float64) where T <: Real
n = 5 # Choose LaGuerre-Conway "n"
i = 0
@@ -14,7 +14,7 @@ function laguerre_conway(state::Vector{Float64}, μ::Float64, time::Float64)
if a > 0 # Elliptical
ΔM = ΔE_new = (μ) / sqrt(a^3) * time
ΔE = 1000
while abs(ΔE - ΔE_new) > 1e-12
while abs(ΔE - ΔE_new) > 1e-10
ΔE = ΔE_new
F = ΔE - ΔM + σ0 / (a) * (1-cos(ΔE)) - coeff * sin(ΔE)
dF = 1 + σ0 / (a) * sin(ΔE) - coeff * cos(ΔE)
@@ -32,7 +32,7 @@ function laguerre_conway(state::Vector{Float64}, μ::Float64, time::Float64)
ΔN = (μ) / sqrt(-a^3) * time
ΔH = 0
ΔH_new = time < 0 ? -1 : 1
while abs(ΔH - ΔH_new) > 1e-12
while abs(ΔH - ΔH_new) > 1e-10
ΔH = ΔH_new
F = -ΔN - ΔH + σ0 / (-a) * (cos(ΔH)-1) + coeff * sin(ΔH)
dF = -1 + σ0 / (-a) * sin(ΔH) + coeff * cos(ΔH)