/AutoDiff

Code snippets accompanying the talk "Automatic Differentiation in Haskell."

Primary LanguageHaskellGNU General Public License v3.0GPL-3.0

AutoDiff

Code snippets accompanying the talk "Automatic Differentiation in Haskell."

This "README.md" and the code snippets contained in this repository are copyright (c) 2016 Daniel Brice, under the terms of the GNU GPL Version 3 (included as "LICENSE.txt").

Do not use these code snippets for anything important. Use Kmett's "ad" package, instead.

Pull requests welcomed.

Tangent Line Problem: A Motivating Example

  • Graph y = x^2
  • Explain problem, find slope of tangent line at (3, 9)
  • Manually approximate, difference quotient

Numerical Differentiation

  • Implement in Haskell
  • Point out problems
    • complexity
    • accuracy

Abstraction to the Rescue

  • Think of the expression as an object of study in its own right
  • Carry out the algorithm on the expression (not on the numbers)
  • arrive at an expression for the derivative

Automatic Differentiation

{ ... }

Acknowledgments

Thanks to Branium for hosting. Thanks to the Santa Monica Haskell User Group for giving me the chance to speak.

Special thanks to Phil Freeman, for noticing that the symbolic differentiation works automatically, without needing to repeat the code in "AutoDiff.hs".

Further Reading