Skip to content

Commit

Permalink
Fix a test, and catch empty interval warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenet committed Jan 18, 2024
1 parent 6a3be15 commit 68ae05c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ eeuler = Base.MathConstants.e
a = interval(1, 2)
b = interval(-1, 1)
c = interval(0, 1)
p4(x, a) = x^4 + 4*a*x^3 + 6*a^2*x^2 + 4*a^3*x + a^4
p5(x, a) = x^5 + 5*a*x^4 + 10*a^2*x^3 + 10*a^3*x^2 + 5*a^4*x + a^5
# ifour = interval(4)
# ifive = interval(5)
# isix = interval(6)
# iten = interval(10)
# p4(x, a) = x^4 + ifour*a*x^3 + isix*a^2*x^2 + ifour*a^3*x + a^4
# p5(x, a) = x^5 + ifive*a*x^4 + iten*a^2*x^3 + iten*a^3*x^2 + ifive*a^4*x + a^5
# p4(x, a) = x^4 + 4*a*x^3 + 6*a^2*x^2 + 4*a^3*x + a^4
# p5(x, a) = x^5 + 5*a*x^4 + 10*a^2*x^3 + 10*a^3*x^2 + 5*a^4*x + a^5
ifour = interval(4)
ifive = interval(5)
isix = interval(6)
iten = interval(10)
p4(x, a) = x^4 + ifour*a*x^3 + isix*a^2*x^2 + ifour*a^3*x + a^4
p5(x, a) = x^5 + ifive*a*x^4 + iten*a^2*x^3 + iten*a^3*x^2 + ifive*a^4*x + a^5

ti = Taylor1(Interval{Float64}, 10)
x, y = set_variables(Interval{Float64}, "x y")
Expand Down Expand Up @@ -48,7 +48,7 @@ eeuler = Base.MathConstants.e
@test isequal_interval(evaluate(p4(x,y), [a, -b]), p4(a, -b))
@test isequal_interval((p5(x,y))([a, b]), p5(a, b))
@test issubset_interval((a-b)^4, ((x-y)^4)([a, b]))
@test isequal_interval((((x-y)^4)[4])([a, b]), interval(-64, 81))
@test isequal_interval((((x-y)^4)[4])([a, b]), interval(-39, 81))

p4n = normalize_taylor(p4(x,y), [a, b], true)
@test issubset_interval(interval(0, 16), p4n([b, b]))
Expand Down Expand Up @@ -153,8 +153,8 @@ eeuler = Base.MathConstants.e
@test_throws DomainError acosh(interval(0.0, 1.0) + x)
@test acosh(interval(0.0, 2.0) + x) == acosh(interval(1.0, 2.0) + x)
# atanh defined on interval(-1,1)
@test_throws DomainError atanh(interval(1.0, 1.0) + ti)
@test_logs (:warn, "invalid interval, empty interval is returned") @test_throws DomainError atanh(interval(1.0, 1.0) + ti)
@test atanh(interval(-2.0, 0.0) + ti) == atanh(interval(-1.0, 0.0) + ti)
@test_throws DomainError atanh(interval(1.0, 1.0) + y)
@test_logs (:warn, "invalid interval, empty interval is returned") @test_throws DomainError atanh(interval(1.0, 1.0) + y)
@test atanh(interval(-2.0, 0.0) + y) == atanh(interval(-1.0, 0.0) + y)
end

0 comments on commit 68ae05c

Please sign in to comment.