Skip to content

Commit

Permalink
Reduce required accuracy of some QuadGK integrals
Browse files Browse the repository at this point in the history
This regressed in v2.8.1:
<#134 (comment)>.
  • Loading branch information
giordano committed Feb 15, 2023
1 parent 7a414e3 commit fcc1e1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,10 @@ end

@testset "QuadGK" begin
@test QuadGK.quadgk(cos, x, y)[1] sin(y) - sin(x)
@test QuadGK.quadgk(sin, -y, y)[1] cos(-y) - cos(y) atol = eps(Float64)
@test QuadGK.quadgk(sin, -y, y)[1] cos(-y) - cos(y) atol = 2 * eps(Float64)
@test QuadGK.quadgk(exp, 0.4, x)[1] exp(x) - exp(0.4)
@test QuadGK.quadgk(sin, w, 2.7)[1] cos(w) - cos(2.7)
@test QuadGK.quadgk(t -> cos(x - t), 0, 2pi)[1] measurement(0) atol = 7e-16

This comment has been minimized.

Copy link
@stevengj

stevengj Feb 16, 2023

You should really pass an atol to quadgk, as well as to the @test, for an integral that should be ≈ 0!

@test QuadGK.quadgk(t -> cos(x - t), 0, 2pi)[1] measurement(0) atol = 2e-13
@test QuadGK.quadgk(t -> exp(t / w), 0, 1)[1] w * (exp(1 / w) - one(x))
for a in (w, x, y)
@test QuadGK.quadgk(t -> 1 / abs2(t / a), 1, Inf)[1] a ^ 2
Expand All @@ -866,7 +866,7 @@ end
@test QuadGK.quadgk(cos, x, y)[1]
@uncertain(((x,y) -> QuadGK.quadgk(cos, x, y)[1])(x, y))
@test QuadGK.quadgk(sin, -y, y)[1]
@uncertain((x -> QuadGK.quadgk(sin, -x, x)[1])(y)) atol = 1e-10
@uncertain((x -> QuadGK.quadgk(sin, -x, x)[1])(y)) atol = 5e-10
@test QuadGK.quadgk(exp, 0.4, x)[1]
@uncertain((x -> QuadGK.quadgk(exp, 0.4, x)[1])(x))
end
Expand Down

0 comments on commit fcc1e1b

Please sign in to comment.