Code Monkey home page Code Monkey logo

autodiff's Introduction

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

See the talk on YouTube. (Though I hate listening to recordings of myself -_-)

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

autodiff's People

Contributors

friedbrice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

autodiff's Issues

nesting

*AutoDiff> let shouldBeOne = d (\x -> d (x*) 1) 1
*AutoDiff> shouldBeOne
0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.