Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong answer for 2D example in docs #149

Closed
dpsanders opened this issue Oct 29, 2023 · 2 comments · Fixed by #150
Closed

Wrong answer for 2D example in docs #149

dpsanders opened this issue Oct 29, 2023 · 2 comments · Fixed by #150

Comments

@dpsanders
Copy link

dpsanders commented Oct 29, 2023

julia> h(x) = sin(x[1]) - cos(x[2]) - sin(x[1]) * cos(x[1])
h (generic function with 1 method)

julia> Dh = IntervalBox(-5..5, -5..5)
[-5.0, 5.0]²

julia> Rh = enclose(h, Dh, BranchAndBoundEnclosure())
[-0.970576, 0.403252]

This is different from what's in the docs and is completely wrong.


(@v1.9) pkg> st
Status `~/.julia/environments/v1.9/Project.toml`
⌃ [79e6a3ab] Adapt v3.6.2
  [6e4b80f9] BenchmarkTools v1.3.2
  [5789e2e9] FileIO v1.16.1
  [fb4d412d] FixedPointDecimals v0.4.3
  [e9467ef8] GLMakie v0.8.11
  [2cbf6e9d] HardSphereDynamics v0.1.3 `~/Dropbox/packages/HardSphereDynamics`
  [d1acc4aa] IntervalArithmetic v0.21.2
  [ee78f7c6] Makie v0.19.11
  [5fb14364] OhMyREPL v0.5.23
  [91a5bcdd] Plots v1.39.0
⌃ [c3e4b0f8] Pluto v0.19.29
  [9c30249a] RAI v0.2.8
  [1b4d18b6] RangeEnclosures v0.2.2
⌃ [295af30f] Revise v3.5.6
  [90137ffa] StaticArrays v1.6.5
⌅ [2913bbd2] StatsBase v0.33.21

Version info:

  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 12 × Apple M2 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
@lucaferranti
Copy link
Member

interesting, this seems to be due to some changes introduced in IA v0.21

(jl_Nk2nko) pkg> st
Status `/tmp/jl_Nk2nko/Project.toml`
  [d1acc4aa] IntervalArithmetic v0.21.2
  [1b4d18b6] RangeEnclosures v0.2.2

julia> using RangeEnclosures

julia> using IntervalArithmetic

julia> h(x) = sin(x[1]) - cos(x[2]) - sin(x[1]) * cos(x[1])
h (generic function with 1 method)

julia> Dh = IntervalBox(-5 .. 5, -5 .. 5)

[-5.0, 5.0]²

julia> res = enclose(h, Dh, BranchAndBoundEnclosure())
[-0.970576, 0.403252]

Because using 0.20 it works as expected

(jl_NwKnpk) pkg> st
Status `/tmp/jl_NwKnpk/Project.toml`
⌃ [d1acc4aa] IntervalArithmetic v0.20.9
  [1b4d18b6] RangeEnclosures v0.2.2
Info Packages marked with ⌃ have new versions available and may be upgradable.

julia> using RangeEnclosures, IntervalArithmetic
[ Info: Precompiling RangeEnclosures [1b4d18b6-9e5d-11e9-236c-f792b01831f8]

julia> h(x) = sin(x[1]) - cos(x[2]) - sin(x[1]) * cos(x[1])
h (generic function with 1 method)

julia> Dh = IntervalBox(-5 .. 5, -5 .. 5)
[-5, 5]²

julia> res = enclose(h, Dh, BranchAndBoundEnclosure())
[-2.71068, 2.71313]

the reason why this goes undetected on the unit tests is because on CI we use IA 0.20 (because some optional dependencies, e.g. TaylorModels.jl I believe, do not support yet IA 0.21

@lucaferranti
Copy link
Member

Ah, I think I found the issue, one sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants