added Logarithmic integral function#500
added Logarithmic integral function#500Bumblebee00 wants to merge 5 commits intoJuliaMath:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #500 +/- ##
==========================================
+ Coverage 94.07% 94.09% +0.01%
==========================================
Files 14 14
Lines 2905 2911 +6
==========================================
+ Hits 2733 2739 +6
Misses 172 172
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/expint.jl
Outdated
| if x < 0 | ||
| throw(DomainError(x, "negative argument, convert to complex first")) | ||
| elseif x == 0 | ||
| return 0 |
There was a problem hiding this comment.
This creates a type instability.
There was a problem hiding this comment.
could this solve it?
elseif x == 0
return zero(typeof(x))
There was a problem hiding this comment.
but you probably want zero(float(x))
test/expint.jl
Outdated
| @test li(0.0) == 0 | ||
| @test li(1.0) == -Inf | ||
| @test li(Inf) === Inf | ||
| @test li(2) ≈ 1.0451637801174927 |
There was a problem hiding this comment.
| @test li(0.0) == 0 | |
| @test li(1.0) == -Inf | |
| @test li(Inf) === Inf | |
| @test li(2) ≈ 1.0451637801174927 | |
| @test @inferred(li(0.0)) === 0.0 | |
| @test @inferred(li(1.0)) === -Inf | |
| @test @inferred(li(Inf)) === Inf | |
| @test @inferred(li(2)) ≈ 1.0451637801174927 |
There was a problem hiding this comment.
Maybe add tests with Float32 as well, also to ensure that there are no unintended promotions to Float64?
There was a problem hiding this comment.
I just don't understand why:
julia> @inferred(li(2))
ERROR: return type Float64 does not match inferred return type Union{Float64, Int64}
in this case is wanted that calling the function with a int returns a float, right?
| # Logarithmic integral function li | ||
|
|
||
| @doc raw""" | ||
| li(x::Real) |
There was a problem hiding this comment.
Maybe a more descriptive name such as logintegral (see https://reference.wolfram.com/language/ref/LogIntegral.html) would be better?
There was a problem hiding this comment.
li is the common name in math, we could go logint to match expinti..
Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
I added the Logarithmic integral function definied as
As is written here I implemented it as Ei(ln(x)) where Ei is the
expintifunction.I also updated the docs, I hope to have done everything correctly but it's my first time contributing here so I am not sure.
I want to add this function becasue I am writing a symbolic integration software and I need to implement the result of the integral 1/ln(x)