Skip to content

Commit 3aacf45

Browse files
authored
Derivative of exponential integral (#99)
* Derivative of exponential integral General form: $$ \frac{d}{dx} E_\nu(x) = -E_{\nu - 1}(x) $$ Special case: $$ \frac{d}{dx} E_0(x) = -\frac{e^{-x}}{x} $$ Source: https://en.wikipedia.org/wiki/Exponential_integral#Derivatives * Bump SpecialFunctions compatibility to >=1.1 Exponential integral (`expint`) was only introduced in 1.0... https://github.com/JuliaMath/SpecialFunctions.jl/releases/tag/v1.0.0 ...but with spurious domain errors, which were fixed in 1.1 (at least fixed-enough that this package's tests pass.) https://github.com/JuliaMath/SpecialFunctions.jl/releases/tag/v1.1.0
1 parent 1ff111f commit 3aacf45

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1313
IrrationalConstants = "0.1.1, 0.2"
1414
LogExpFunctions = "0.3.2"
1515
NaNMath = "0.3, 1"
16-
SpecialFunctions = "0.10, 1.0, 2"
16+
SpecialFunctions = "1.1, 2"
1717
julia = "1.3"
1818

1919
[extras]

src/rules.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ _abs_deriv(x) = sign(x)
181181
@define_diffrule SpecialFunctions.ellipe(m) =
182182
:( (SpecialFunctions.ellipe($m) - SpecialFunctions.ellipk($m)) / (2 * $m) )
183183

184+
@define_diffrule SpecialFunctions.expint(x) = :( -exp(-$x) / $x )
185+
184186
# TODO:
185187
#
186188
# eta
@@ -236,6 +238,10 @@ _abs_deriv(x) = sign(x)
236238
@define_diffrule SpecialFunctions.logbeta(a, b) =
237239
:( SpecialFunctions.digamma($a) - SpecialFunctions.digamma($a + $b) ), :( SpecialFunctions.digamma($b) - SpecialFunctions.digamma($a + $b) )
238240

241+
# derivative wrt to `ν` is not implemented
242+
@define_diffrule SpecialFunctions.expint(ν, x) =
243+
:NaN, :( -SpecialFunctions.expint($ν - 1, $x) )
244+
239245
# derivative wrt to `s` is not implemented
240246
@define_diffrule SpecialFunctions.zeta(s, z) =
241247
:NaN, :( - $s * SpecialFunctions.zeta($s + 1, $z) )

0 commit comments

Comments
 (0)