From 5a3a61ebb5c88e28945f0053b0b172ae17591ef0 Mon Sep 17 00:00:00 2001 From: hibiki-kato Date: Sat, 8 Nov 2025 18:39:58 -0500 Subject: [PATCH 1/3] =?UTF-8?q?Enhance=20type=20flexibility=20for=20Poinca?= =?UTF-8?q?reMap=20and=20add=20a=20Bigfloat=20test=20for=20Poincar=C3=A9?= =?UTF-8?q?=20mapping.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/derived_systems/poincare/poincaremap.jl | 14 ++++++++------ test/poincare.jl | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/derived_systems/poincare/poincaremap.jl b/src/derived_systems/poincare/poincaremap.jl index b119f7a0..42733482 100644 --- a/src/derived_systems/poincare/poincaremap.jl +++ b/src/derived_systems/poincare/poincaremap.jl @@ -95,18 +95,18 @@ next_state_on_psos = current_state(pmap) Datseris & Parlitz 2022, _Nonlinear Dynamics: A Concise Introduction Interlaced with Code_, [Springer Nature, Undergrad. Lect. Notes In Physics](https://doi.org/10.1007/978-3-030-91032-7) """ -mutable struct PoincareMap{I<:ContinuousTimeDynamicalSystem, F, P, R, V} <: DiscreteTimeDynamicalSystem +mutable struct PoincareMap{I<:ContinuousTimeDynamicalSystem, F, P, R, U<:Real, V} <: DiscreteTimeDynamicalSystem ds::I plane_distance::F planecrossing::P - Tmax::Float64 + Tmax::U rootkw::R state_on_plane::V - tcross::Float64 + tcross::U t::Int # These two fields are for setting the state of the pmap from the plane # (i.e., given a D-1 dimensional state, create the full D-dimensional state) - dummy::Vector{Float64} + dummy::Vector{U} diffidxs::Vector{Int} state_initial::V end @@ -125,11 +125,13 @@ function PoincareMap( planecrossing = PlaneCrossing(plane, direction > 0) plane_distance = (t) -> planecrossing(ds(t)) v = recursivecopy(current_state(ds)) - dummy = zeros(D) + tcross = current_time(ds) + Tmax = convert(typeof(tcross), Tmax) + dummy = zeros(eltype(v), D) diffidxs = _indices_on_poincare_plane(plane, D) pmap = PoincareMap( ds, plane_distance, planecrossing, Tmax, rootkw, - v, current_time(ds), 0, dummy, diffidxs, recursivecopy(v), + v, tcross, 0, dummy, diffidxs, recursivecopy(v), ) step!(pmap) # this ensures that the state is on the hyperplane pmap.state_initial = recursivecopy(current_state(pmap)) diff --git a/test/poincare.jl b/test/poincare.jl index 2f3bcaf7..ee1519f0 100644 --- a/test/poincare.jl +++ b/test/poincare.jl @@ -99,3 +99,24 @@ end @test all(x -> abs(x) < 1e-12, B[:, 1]) @test vec(A) == vec(B) end + +@testset "PoincareMap BigFloat" begin + setprecision(113) # quadruple precision + u0Big = BigFloat.(u0) + pBig = BigFloat.(p) + ds = CoupledODEs(gissinger_rule, u0Big, pBig) + rootkw = (xrtol = BigFloat(1e-25), atol = BigFloat(1e-25)) + pmap = PoincareMap(ds, plane1; + rootkw = rootkw, + ) + + # check if everything is BigFloat + @test typeof(current_crossing_time(pmap)) == BigFloat + @test typeof(pmap.Tmax) == BigFloat + @test eltype(current_state(pmap)) == BigFloat + + # check if BigFloat works + pmap = poincaresos(ds, plane1, 100; rootkw = rootkw) + @test eltype(pmap[1]) == BigFloat + @test all(x -> abs(x) < 1e-20, pmap[:, 1]) +end \ No newline at end of file From c6b7e0aac5303074f7cc9231a1b827ebf52200a2 Mon Sep 17 00:00:00 2001 From: hibiki-kato Date: Mon, 10 Nov 2025 21:23:06 -0500 Subject: [PATCH 2/3] Remove `setprecision` and designate precision locally. --- test/poincare.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/poincare.jl b/test/poincare.jl index ee1519f0..06795c9a 100644 --- a/test/poincare.jl +++ b/test/poincare.jl @@ -101,11 +101,10 @@ end end @testset "PoincareMap BigFloat" begin - setprecision(113) # quadruple precision - u0Big = BigFloat.(u0) - pBig = BigFloat.(p) + u0Big = BigFloat.(u0, 113) + pBig = BigFloat.(p, 113) ds = CoupledODEs(gissinger_rule, u0Big, pBig) - rootkw = (xrtol = BigFloat(1e-25), atol = BigFloat(1e-25)) + rootkw = (xrtol = BigFloat(1e-25, 113), atol = BigFloat(1e-25, 113)) pmap = PoincareMap(ds, plane1; rootkw = rootkw, ) From ce51d3473d1838d7fc8b64d75246ef017afa52ff Mon Sep 17 00:00:00 2001 From: hibiki-kato Date: Mon, 10 Nov 2025 21:28:42 -0500 Subject: [PATCH 3/3] Increment the patch version from 3.15.1 to 3.15.2. --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4320c6b6..3b3825fe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DynamicalSystemsBase" uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4" repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git" -version = "3.15.1" +version = "3.15.2" [deps] ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"