Python bindings for num-dual: Generalized (hyper) dual numbers for the calculation of exact (partial) derivatives
Project description
dualnum
Python bindings for the num-dual
rust crate.
Installation
pip install dualnum
Installation from source
To install from source, you need to have the rust compiler installed.
pip install git+https://github.com/itt-ustutt/dualnum
Sphinx documentation
To build the documentation with sphinx:
maturin develop --release
cd docs
make html
make doctest
firefox _build/html/index.html
Usage
Compute first and second derivative of a scalar valued function.
from dualnum import derive2
import numpy as np
def f(x):
return np.exp(x) / np.sqrt(np.sin(x)**3 + np.cos(x)**3)
x = derive2(1.5)
result = f(x)
print('f(x) = {}'.format(result.value))
print('df/dx = {}'.format(result.first_derivative))
print('d2f/dx2 = {}'.format(result.second_derivative))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file dualnum-0.2.1-cp36-abi3-win_amd64.whl
.
File metadata
- Download URL: dualnum-0.2.1-cp36-abi3-win_amd64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.6+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cffffcb1865c1eabbd7a2971e07f5439195419d75bc499a2cec522a9ca11cd46 |
|
MD5 | 4723060a52e142cbe90379d5be92cd45 |
|
BLAKE2b-256 | f9f73d340629613812711365687d3b316a08788a44ea7ad502e668965cf1673d |
File details
Details for the file dualnum-0.2.1-cp36-abi3-win32.whl
.
File metadata
- Download URL: dualnum-0.2.1-cp36-abi3-win32.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.6+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df3100ce04ff0578fed92c010ce2686aae2f69fea207a8ecfd882d5ce2f27860 |
|
MD5 | 7f95288189dff820943b571a8d6d0e3d |
|
BLAKE2b-256 | 54b744ce5707153942af84545730b31c53b5f10f21ab713779fdaf7b37890d2e |
File details
Details for the file dualnum-0.2.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
.
File metadata
- Download URL: dualnum-0.2.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.6+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43b6ed6d4fb5c2426f9933acfc314cf26630247cb1dabd897d5208b2cad8a5f |
|
MD5 | b410cc8378238340ee08c794c2321f7e |
|
BLAKE2b-256 | 3d1ff2ca42ecd1a2c51b390c6e6acd10ddc10592272eab35c89a70e664fef661 |
File details
Details for the file dualnum-0.2.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
.
File metadata
- Download URL: dualnum-0.2.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.6+, macOS 10.9+ universal2 (ARM64, x86-64), macOS 10.9+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3300699ed4f70eb0b17dfe0bad9b9b3f63aa92adfe916534f5ddbe623ca27191 |
|
MD5 | 12cf9ef609670d1fffc27b3f5e986852 |
|
BLAKE2b-256 | a93a9aa7f047e362d41f0a121e4fabdcc8037749883e22a17647f575912b875b |
File details
Details for the file dualnum-0.2.1-cp36-abi3-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: dualnum-0.2.1-cp36-abi3-macosx_10_7_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.6+, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee482b73d51fa611278be6763f85033113a1773c15751651d5569410f8d80b55 |
|
MD5 | 82daa3c525fbde2bec9d953e5f072818 |
|
BLAKE2b-256 | 89bd33aa0b4d01e56a747b35930d81ec7b614cf5a5afe88af854b45d26096a37 |