Skip to main content

Python bindings for num-dual: Generalized (hyper) dual numbers for the calculation of exact (partial) derivatives

Project description

dualnum

documentation PyPI version

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

dualnum-0.2.1-cp36-abi3-win_amd64.whl (1.8 MB view hashes)

Uploaded CPython 3.6+ Windows x86-64

dualnum-0.2.1-cp36-abi3-win32.whl (1.5 MB view hashes)

Uploaded CPython 3.6+ Windows x86

dualnum-0.2.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.6+ manylinux: glibc 2.5+ x86-64

dualnum-0.2.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.1 MB view hashes)

Uploaded CPython 3.6+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

dualnum-0.2.1-cp36-abi3-macosx_10_7_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page