# A package or built-in function for algorithmic/automatic differentiation?

**URL:** <https://community.wolfram.com/t/a-package-or-built-in-function-for-algorithmic-automatic-differentiation/23534>\
**Category:** Questions\
**Tags:** calculus, packages-and-paclets\
**Created:** [February 1, 2024, 11:04pm UTC](https://community.wolfram.com/t/a-package-or-built-in-function-for-algorithmic-automatic-differentiation/23534 "2024-02-01T23:04:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamsanfordwright](https://avatars.discourse-cdn.com/v4/letter/w/e9a140/32.png) [@williamsanfordwright](https://community.wolfram.com/u/williamsanfordwright)\
**Post date:** [February 1, 2024, 11:04pm UTC](https://community.wolfram.com/t/a-package-or-built-in-function-for-algorithmic-automatic-differentiation/23534/1 "2024-02-01T23:04:21Z")

</div>

Is there some package or built-in function in Mathematica for algorithmic/automatic differentiation? I’m thinking something with the capabilities of JAX or Autograd for Python. For example, if I have some complicated Python function involving compositions of mathematical functions, control flow statements, etc., JAX and Autograd can compute its derivative at different inputs. Is there some way to do this in Mathematica short of writing a package for it myself?

---

<div class="post-metadata">

**Author:** ![jschrier](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jschrier/32/2242_2.png) [@jschrier](https://community.wolfram.com/u/jschrier)\
**Post date:** [February 2, 2024, 3:39pm UTC](https://community.wolfram.com/t/a-package-or-built-in-function-for-algorithmic-automatic-differentiation/23534/2 "2024-02-02T15:39:51Z")

</div>

There have been some past discussions about this:

You can implement various forms of automatic differentiation in the language:

- Using dual numbers: [https://mathematica.stackexchange.com/questions/1873/is-there-any-automatic-differentiation-package](https://mathematica.stackexchange.com/questions/1873/is-there-any-automatic-differentiation-package)

- Using tensor networks: [Tensor networks, Einsum optimizers and the path towards autodiff](https://wolfram.discourse.group/t/19339/1)

If you are referring to autodifferentiation of neural networks…the current system (as of 14.0) based on MXNet does not seem to support doing this.

- Discussion on StackExchange: [https://mathematica.stackexchange.com/questions/256323/neural-network-automatic-differentiation-autograd](https://mathematica.stackexchange.com/questions/256323/neural-network-automatic-differentiation-autograd)
- Discussion about MXNet and its limits: [About MxNet as Mathematica backend choice](https://wolfram.discourse.group/t/18927/1)

---

<div class="post-metadata">

**Author:** ![williamsanfordwright](https://avatars.discourse-cdn.com/v4/letter/w/e9a140/32.png) [@williamsanfordwright](https://community.wolfram.com/u/williamsanfordwright)\
**Post date:** [February 2, 2024, 7:14pm UTC](https://community.wolfram.com/t/a-package-or-built-in-function-for-algorithmic-automatic-differentiation/23534/3 "2024-02-02T19:14:34Z")

</div>

Much appreciated; the dual number package was very helpful.
