From 5a84cb7aa491d633060a0e0d61f823471394eb3a Mon Sep 17 00:00:00 2001 From: jverzani Date: Wed, 4 Sep 2024 09:55:18 -0400 Subject: [PATCH] add adjust_bracket --- Project.toml | 2 +- src/Bracketing/chandrapatlu.jl | 1 + test/test_bracketing.jl | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 6480015d..6592da9a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Roots" uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" -version = "2.1.7" +version = "2.1.8" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" diff --git a/src/Bracketing/chandrapatlu.jl b/src/Bracketing/chandrapatlu.jl index 0c0d05fd..c506396d 100644 --- a/src/Bracketing/chandrapatlu.jl +++ b/src/Bracketing/chandrapatlu.jl @@ -24,6 +24,7 @@ end # a = most recent, b prior function init_state(::Chandrapatla, F, x₀, x₁, fx₀, fx₁) a, b, fa, fb = x₁, x₀, fx₁, fx₀ + assert_bracket(fa, fb) c, fc = a, fa ChandrapatlaState(promote(a, b, c)..., promote(fa, fb, fc)...) end diff --git a/test/test_bracketing.jl b/test/test_bracketing.jl index d9b8af86..c4b7dc2f 100644 --- a/test/test_bracketing.jl +++ b/test/test_bracketing.jl @@ -313,9 +313,9 @@ end @test avg(cnts) <= 3000 ## issue 412 check for bracket - f = x -> x - 1 for M in Ms - @test_throws ArgumentError find_zero(f, (-3, 0), M) + @test_throws ArgumentError find_zero(x -> x - 1, (-3, 0), M) + @test_throws ArgumentError find_zero(x -> 1 + x^2, (10, 20), M) end end