Closed Cazadorro closed 4 years ago
This was a straight port from https://github.com/mathnet/mathnet-numerics/blob/master/src/Numerics/SpecialFunctions/ExponentialIntegral.cs, the original intention of the project was to replicate the statistical functionality provided by Math.NET in Rust.
As to where the original C# author sources his implementation that I do not know
@boxtown
Thanks! That clarifies a lot
I also researched a bit more. Exponential integral refers to both Ei, and E1, You guys implemented E1 (E1 = (-Ei(-x))), and I'm used to exponential integral primarily refering to Ei (in mathematics and CS, you often won't even find E1 in some literature, Wolfram alpha for example doesn't even mention it). There is apparently no separate long form name for each. So that solves on large part of this mystery.
The next issue is that this:
The continued fraction approac is used for
x > 1.0
is not the normal continued fraction function. It is an approximation for incomplete gamma function in combination and putting E1 interms of incomplete gamma according to the other repo.
I'll have to check the other repo out to understand more, so I'll be closing this issue.
I can't track down the source for the Ei function found in functions::exponential::integral.
In the documentation it says:
I understand it is using a continued fraction for large values, and series for small, but I'm not finding the implementation reference in any of those sources. The only place I can find a reference to continued fractions in "Advanced mathematical methods for scientists and engineers" is page 395+, "8.4 Continued fractions and pade approximants". It is possible they had a different print of the book, but in such case, giving the page number is useless, there should be a reference to chapter and sub section.
There doesn't appear to be any implementation of Ei there either, but the chapter does go over how to develop your own continued fractions. In such a case, I would expect such a fraction to look very similar to the one found on the wikipediapage (even though it is E1, not Ei). It doesn't appear to. Additionally I would expect that if the module authors created it themselves this would be explained in the documentation, but it still seems as if the authors sourced the implementaiton from somewhere else. Note the exponential integral continued fraction here is only valid for negative ranges of input as well, and is corroborated by this source https://functions.wolfram.com/GammaBetaErf/ExpIntegralEi/10/.
I'm also not entirely sure the justification for much of the algorithmic decisions there. I don't understand why there exists a epsilon term (why it would even be needed for continued fraction which can be implemented with out it), which appears to be sourced from elsewhere, but as I said, such justifications are not found in the referenced material. Additionally, the 'n' term, which I would normally associate with the max iteration count, is used for unknown purposes, it appears to be based on this definition of https://dlmf.nist.gov/8.19#i where instead of giving a scalar argument, you have a base and a power, which is not something I've seen in any of the other sources I've encountered thus far.
Can someone shed some light on these implementations?