Skip to content

Conversation

ashiklom
Copy link
Contributor

@ashiklom ashiklom commented Jun 2, 2023

General form:

$$ \frac{d}{dx} E_\nu(x) = -E_{\nu - 1}(x) $$

Note that:

$$ E_0(x) = \frac{e^{-x}}{x} $$

Therefore, derivative of SpecialFunctions.expint(x) ($E_1(x)$) is:

$$ \frac{d}{dx} E_1(x) = -E_0(x) = -\frac{e^{-x}}{x} $$

Source: Wikipedia

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
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (fee3857) 97.86% compared to head (fed2f7d) 97.88%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #99      +/-   ##
==========================================
+ Coverage   97.86%   97.88%   +0.02%     
==========================================
  Files           3        3              
  Lines         187      189       +2     
==========================================
+ Hits          183      185       +2     
  Misses          4        4              
Impacted Files Coverage Δ
src/rules.jl 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@devmotion
Copy link
Member

Looks mainly good (it also matches the rules we added to SpecialFunctions, e.g., https://github.com/JuliaMath/SpecialFunctions.jl/blob/ae35d10713a470b852e53e0c79f20252b5572fa9/ext/SpecialFunctionsChainRulesCoreExt.jl#L183). I am pretty sure though that it requires us to update the SpecialFunctions compat entry since IIRC these functions require a relatively recent release of SpecialFunctions. Can you check this?

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
@ashiklom
Copy link
Contributor Author

ashiklom commented Jun 2, 2023

Good catch! Looks like this starts to work (or at least, all the tests pass) starting in SpecialFunctions v1.1. Bumped compatibility accordingly.

@devmotion devmotion merged commit 3aacf45 into JuliaDiff:master Jun 3, 2023
ashiklom added a commit to ashiklom/CanopyOptics.jl that referenced this pull request Jun 9, 2023
Now that JuliaDiff/DiffRules.jl#99 has been
merged, no longer need the custom implementation. Also, native symbolic
ForwardDiff implementation based on DiffRules is faster!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants