Automatic differentiation in Ruby

Cd9b247e4507fed75312e9a42070125d?s=47 Tom Stuart
February 08, 2016

Automatic differentiation in Ruby

Finding the derivative of a mathematical function on a computer can be difficult, but there’s a clever trick that makes it easy: first write a program that computes the function, then execute it under a non-standard interpretation of its values and operations. In this talk I’ll show you how that works in Ruby.

Given at the London Ruby User Group ( A video and expanded transcript are available at, and the code is available at


Tom Stuart

February 08, 2016