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
x = ad.DualNumber('x', 2)
y = ad.DualNumber('y', 3)
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):
return 3*a/b*ad.sin(a*b+2)
out = f(ad.DualNumber('x',2),ad.DualNumber('y',3))
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
out = f(ad.DualNumber('x',0),ad.DualNumber('y',1))
A Python 3 notebook containing more in-depth examples and usage is available HERE
Documentation
Click HERE for full documentation.
Dependencies
Click HERE for a full listing of dependencies.
License
Click HERE to view our MIT License.
Metadata
Release files for AutoDiff-group3 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| AutoDiff_group3-0.0.6.tar.gz | 11.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AutoDiff_group3-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.4 kB
Release files / AutoDiff_group3-0.0.6.tar.gz
| Download URL | AutoDiff_group3-0.0.6.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
772ecf6f2c86eef6533e9769437240e8ecee6636aa0747d1f7c81a40a505d748
|
|
BLAKE2b-256 checksum How to use checksums |
5bb429b7f91771b8381c08c098ead7a00065da95ae6e39479d965ce28deef129
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Release files / AutoDiff_group3-0.0.6-py3-none-any.whl
| Download URL | AutoDiff_group3-0.0.6-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9230131d66a759d3fae8d090dffeee4ed9e75ada72f0c5f3a17c3ca1a28c4787
|
|
BLAKE2b-256 checksum How to use checksums |
1720dc354708d50212f7e0315d3fc84cde7c43fa543f6c3d25d0d90721bc79c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Security for AutoDiff-group3 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.