Special function module (#221)

* [fix] Fixed intendation for flake8

* [feat] special module with Bessel functions added.

* [feat] init adapted.

* [tests] First test for special module added.

* [tests] Check kn special function derivative explicitly vs numerical
derivative of scipy function.

* [feat] Added remaining autograd scipy special functions to the special
module.

* [feat] Imports corrected, docstring added.
This commit is contained in:
Fabian Joswig 2024-01-07 17:22:05 +01:00 committed by GitHub
parent 1360942a7b
commit 5122e260ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 1 deletions

12
tests/special_test.py Normal file
View file

@ -0,0 +1,12 @@
import numpy as np
import scipy
import pyerrors as pe
import pytest
from autograd import jacobian
from numdifftools import Jacobian as num_jacobian
def test_kn():
for n in np.arange(0, 10):
for val in np.linspace(0.1, 7.3, 10):
assert np.isclose(num_jacobian(lambda x: scipy.special.kn(n, x))(val), jacobian(lambda x: pe.special.kn(n, x))(val), rtol=1e-10, atol=1e-10)