# Registering Analytical Derivative with ReverseDiff/ForwardDiff

**URL:** <https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543>\
**Category:** Optimization (Mathematical)\
**Created:** [April 25, 2018, 6:15pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543 "2018-04-25T18:15:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crinders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crinders/32/8434_2.png) [@crinders](https://discourse.julialang.org/u/crinders)\
**Post date:** [April 25, 2018, 6:15pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543/1 "2018-04-25T18:15:11Z")

</div>

Is there a way to register a derivative function similar to JuMP’s usage in ForwardDiff or ReverseDiff? I have a small function which solves a simple optimization problem using svd, which isn’t automatically differentiated. But I do know the derivative due to the original formulation.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [April 25, 2018, 6:35pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543/2 "2018-04-25T18:35:46Z")

</div>

[https://github.com/JuliaDiff/ForwardDiff.jl/pull/165](https://github.com/JuliaDiff/ForwardDiff.jl/pull/165) perhaps?

---

<div class="post-metadata">

**Author:** ![crinders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crinders/32/8434_2.png) [@crinders](https://discourse.julialang.org/u/crinders)\
**Post date:** [April 25, 2018, 7:27pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543/3 "2018-04-25T19:27:03Z")

</div>

It seems like that would be exactly what I’m looking for. I’ve requested a status update since it does not seem to be merged with the ForwardDiff package yet.

---

<div class="post-metadata">

**Author:** ![crinders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crinders/32/8434_2.png) [@crinders](https://discourse.julialang.org/u/crinders)\
**Post date:** [April 25, 2018, 7:55pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543/4 "2018-04-25T19:55:51Z")

</div>

I’m currently looking into using `DiffRules.@define_diffrule` since I believe FowardDiff and ReverseDiff fall back on these rules?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [April 25, 2018, 7:56pm UTC](https://discourse.julialang.org/t/registering-analytical-derivative-with-reversediff-forwarddiff/10543/5 "2018-04-25T19:56:48Z")

</div>

Yes, that PR might be replaced with those new stuff in DiffRules.
