Automatic differentiation with dual numbers

# AutoDiff

Developed by: Will Claybaugh, Bruce Xiong, Erin Williams
Group #3, CS207 Fall 2018

## Introduction

Autodiff finds the derivatives of a function (to machine precision!) at the same time it finds the value of the function.

``````import autodiff.autodiff as ad

out = x/y
out.value # 0.66666, the value of 2 divided by 3
out.derivatives #{x: 1/3, y: -2/(3**2)}, the gradient of x/y at (2,3)
``````

Autodiff works for functions and expressions with any number of inputs. Just pass those functions DualNumbers instead of regular ints/floats (and upgrade any math module functions to their autodiff equvalents)

## Installation

Autodiff is on PyPi and can be installed using the command `pip install AutoDiff-group3`. To import, use `import autodiff.autodiff as ad`.

Autodiff can also be installed by downloading from github. Becuase it has no dependencies, you can simply add the repo folder to your python path (`import sys sys.path.insert(0, '/path_to_repo/')`) and import as normal.

## Examples

Using autodiff is very simple:

``````import autodiff.autodiff as ad

def f(a,b):

print(out.value)
1.978716

print(out.derivatives['x'])
0.116358

print(out.derivatives['y'])
-1.24157

# get the value and derifative of f at a different point
``````

A Python 3 notebook containing more in-depth examples and usage is available HERE