Skip to content

Commit 1052c99

Browse files
committed
also fix henon jeiles
1 parent e14bea7 commit 1052c99

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

src/continuous_famous_systems.jl

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -230,30 +230,15 @@ The function `Systems.henonheiles_ics(E, n)` generates a grid of
230230
231231
[^HénonHeiles1964]: Hénon, M. & Heiles, C., The Astronomical Journal **69**, pp 73–79 (1964)
232232
"""
233-
function henonheiles(u0=[0, -0.25, 0.42081, 0]#=; conserveE::Bool = true=#)
234-
i = one(eltype(u0))
235-
o = zero(eltype(u0))
236-
J = zeros(eltype(u0), 4, 4)
237-
return CDS(hhrule!, u0, nothing, hhjacob!, J)
238-
end
239-
function hhrule!(du, u, p, t)
240-
@inbounds begin
241-
du[1] = u[3]
242-
du[2] = u[4]
243-
du[3] = -u[1] - 2u[1]*u[2]
244-
du[4] = -u[2] - (u[1]^2 - u[2]^2)
245-
return nothing
246-
end
247-
end
248-
function hhjacob!(J, u, p, t)
249-
@inbounds begin
250-
o = 0.0; i = 1.0
251-
J[1,:] .= (o, o, i, o)
252-
J[2,:] .= (o, o, o, i)
253-
J[3,:] .= (-i - 2*u[2], -2*u[1], o, o)
254-
J[4,:] .= (-2*u[1], -1 + 2*u[2], o, o)
255-
return nothing
256-
end
233+
function henonheiles(u0=[0, -0.25, 0.42081, 0])
234+
return CDS(henonheiles_rule, u0, nothing)
235+
end
236+
@inbounds function henonheiles_rule(u, p, t)
237+
du1 = u[3]
238+
du2 = u[4]
239+
du3 = -u[1] - 2u[1]*u[2]
240+
du4 = -u[2] - (u[1]^2 - u[2]^2)
241+
return SVector(du1, du2, du3, du4)
257242
end
258243
_hhenergy(x,y,px,py) = 0.5(px^2 + py^2) + _hhpotential(x,y)
259244
_hhpotential(x, y) = 0.5(x^2 + y^2) + (x^2*y - (y^3)/3)

0 commit comments

Comments
 (0)