Skip to content

Commit

Permalink
improved accuracy Debye_function
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMikkelsen committed Mar 8, 2024
1 parent 647e539 commit c286bac
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified .github/.DS_Store
Binary file not shown.
Binary file modified docs/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Debye.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Debye function(n,x) given by
Returns the value ``D(n,x)``
"""
function Debye_function(n,x,min_tol=1e-5)
D = n./(x.^n).*quadgk(t -> (t.^n)/(exp.(t)-1),min_tol,x)[1]
D = n./(x.^n).*quadgk(t -> (t.^n)/(expm1.(t)),min_tol,x)[1]
return D
end
export Debye_function
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ using Test
@test FewSpecialFunctions.Debye_function(1.0, 0.2) 0.951111 atol = 1e-4

@test FewSpecialFunctions.Debye_function(1.0, 1.0) 0.777505 atol = 1e-4
@test FewSpecialFunctions.Debye_function(1.0, 1.3) 0.721173 atol = 1e-4
@test FewSpecialFunctions.Debye_function(1.0, 1.3) 0.721173 atol = 1e-5

@test FewSpecialFunctions.Debye_function(1.0, 2.6) 0.526375 atol = 1e-4
@test FewSpecialFunctions.Debye_function(1.0, 2.8) 0.502682 atol = 1e-4
@test FewSpecialFunctions.Debye_function(1.0, 2.6) 0.526375 atol = 1e-5
@test FewSpecialFunctions.Debye_function(1.0, 2.8) 0.502682 atol = 1e-5

@test FewSpecialFunctions.Debye_function(2.0, 1.3) 0.635800 atol = 1e-4
@test FewSpecialFunctions.Debye_function(2.0, 2.8) 0.368324 atol = 1e-4
@test FewSpecialFunctions.Debye_function(2.0, 1.3) 0.635800 atol = 1e-5
@test FewSpecialFunctions.Debye_function(2.0, 2.8) 0.368324 atol = 1e-5

@test FewSpecialFunctions.Debye_function(3.0, 0.7) 0.761859 atol = 1e-4
@test FewSpecialFunctions.Debye_function(3.0, 2.8) 0.309995 atol = 1e-4
@test FewSpecialFunctions.Debye_function(3.0, 0.7) 0.761859 atol = 1e-5
@test FewSpecialFunctions.Debye_function(3.0, 2.8) 0.309995 atol = 1e-5

@test FewSpecialFunctions.Fresnel_S_integral_pi(0.10) 0.0005236 atol = 1e-4
@test FewSpecialFunctions.Fresnel_S_integral_pi(0.32) 0.0171256 atol = 1e-4
Expand Down

0 comments on commit c286bac

Please sign in to comment.