Crates.io | dualnum |
lib.rs | dualnum |
version | 0.2.1 |
source | src |
created_at | 2021-07-21 09:46:17.498066 |
updated_at | 2021-07-26 14:11:56.737521 |
description | Python bindings for num-dual: Generalized (hyper) dual numbers for the calculation of exact (partial) derivatives |
homepage | https://github.com/itt-ustutt/dualnum |
repository | https://github.com/itt-ustutt/dualnum |
max_upload_size | |
id | 425454 |
size | 53,463 |
Python bindings for the num-dual
rust crate.
pip install dualnum
To install from source, you need to have the rust compiler installed.
pip install git+https://github.com/itt-ustutt/dualnum
To build the documentation with sphinx:
maturin develop --release
cd docs
make html
make doctest
firefox _build/html/index.html
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))