Skip to main content

Provide function to calculate the modified Bessel function of the second kind

Project description

logbesselk

Provide function to calculate the modified Bessel function of the second kind and its derivatives.

Author

TAKEKAWA Takashi takekawa@tk2lab.org

Reference

Takashi Takekawa, Fast parallel calculation of modified Bessel function of the second kind and its derivatives, SoftwareX, 17, 100923, 2022.

Require

  • python >= 3.7
  • tensorflow >= 2.6

Installation

pip install logbesselk

Examples

import tensorflow as tf
from logbesselk.integral import log_bessel_k


log_k = log_bessel_k(v=1.0, x=1.0)
log_dkdv = log_bessel_k(v=1.0, x=1.0, 1, 0)
log_dkdx = log_bessel_k(v=1.0, x=1.0, 0, 1)


# build graph at first execution time
log_bessel_k_tensor = tf.function(log_bessel_k)
log_bessel_dkdv_tensor = tf.function(lambda v, x: log_bessel_k(v, x, 1, 0))
log_bessel_dkdx_tensor = tf.function(lambda v, x: log_bessel_k(v, x, 0, 1))

n = 1000
for i in range(10):
    v = 10. ** (2. * tf.random.uniform((n,), dtype=tf.float64) - 1.
    x = 10. ** (3. * tf.random.uniform((n,), dtype=tf.float64) - 1.)

    log_k = log_bessel_k_tensor(v, x)
    log_dkdv = log_bessel_dkdv_tensor(v, x)
    log_dkdx = log_bessel_dkdx_tensor(v, x)

Evaluation

python -m eval.prec
python -m eval.time
python -m eval.scale
python -m eval.fig1
python -m eval.fig2
python -m eval.fig3
python -m eval.fig4
python -m eval.fig5
python -m eval.fig6
python -m eval.fig7

Project details


Download files

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

Source Distribution

logbesselk-2.4.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

logbesselk-2.4.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file logbesselk-2.4.1.tar.gz.

File metadata

  • Download URL: logbesselk-2.4.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.14 Linux/5.15.0-1022-azure

File hashes

Hashes for logbesselk-2.4.1.tar.gz
Algorithm Hash digest
SHA256 0c27babcb53b8c2a19709a05fbae7df2908deb34d673efecc6404363a3686b1b
MD5 d01ca638d914a6ff79cb2a6e1fbd6add
BLAKE2b-256 e91ac17d8c800ddcd195431bfbf2dfb41bf48d9a9bed76beaa68fa85be60f469

See more details on using hashes here.

File details

Details for the file logbesselk-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: logbesselk-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.14 Linux/5.15.0-1022-azure

File hashes

Hashes for logbesselk-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a49b82a774ec83c8beec6e758db14f10537f9647983130528f6ccd9eeba72eab
MD5 a2116a3ca68050a01cd437a80ebaca27
BLAKE2b-256 989c4b2c5e987ff0e420f5a7998b7c666c5d994b7226dc48bd888d318b3c19e7

See more details on using hashes here.

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