JuliaDiff / TaylorDiff.jl

Taylor-mode automatic differentiation for higher-order derivatives
https://juliadiff.org/TaylorDiff.jl/
MIT License
73 stars 8 forks source link

Add support for mixed partial derivatives #59

Closed tansongchen closed 1 year ago

tansongchen commented 1 year ago

This added support for applying derivative twice or more times on a function for mixed partial derivatives. Solves #43 .


Example:

$$\frac{\mathrm d^5u}{\mathrm dx^2dy^3}$$

as two sequential operation,

# v = [x, y]
u(v) = v[1] ^ 2 * v[2] ^ 3
uxx(v) = derivative(u, v, [1., 0.], 2)
uxxyyy(v) = derivative(uxx, v, [0., 1.], 3)

so that

uxxyyy([2., 3.]) # 12

There are currently some code generation problems that prevents me to do that, but I will fix that soon.

codecov[bot] commented 1 year ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (e4d943c) 85.48% compared to head (8e20cd8) 84.58%. Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #59 +/- ## ========================================== - Coverage 85.48% 84.58% -0.90% ========================================== Files 6 6 Lines 248 253 +5 ========================================== + Hits 212 214 +2 - Misses 36 39 +3 ``` | [Files](https://app.codecov.io/gh/JuliaDiff/TaylorDiff.jl/pull/59?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff) | Coverage Δ | | |---|---|---| | [src/derivative.jl](https://app.codecov.io/gh/JuliaDiff/TaylorDiff.jl/pull/59?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff#diff-c3JjL2Rlcml2YXRpdmUuamw=) | `100.00% <100.00%> (ø)` | | | [src/scalar.jl](https://app.codecov.io/gh/JuliaDiff/TaylorDiff.jl/pull/59?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff#diff-c3JjL3NjYWxhci5qbA==) | `85.29% <ø> (ø)` | | | [src/chainrules.jl](https://app.codecov.io/gh/JuliaDiff/TaylorDiff.jl/pull/59?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff#diff-c3JjL2NoYWlucnVsZXMuamw=) | `70.14% <50.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/JuliaDiff/TaylorDiff.jl/pull/59/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.