{ } Raw JSON

bundles / scipy 1.17.1 / scipy / special / _basic / kvp

function

scipy.special._basic:kvp

source: /scipy/special/_basic.py :977

Signature

def   kvp ( v z n = 1 )

Summary

Compute derivatives of real-order modified Bessel function Kv(z)

Extended Summary

Kv(z) is the modified Bessel function of the second kind. Derivative is calculated with respect to z.

Parameters

v : array_like of float

Order of Bessel function

z : array_like of complex

Argument at which to evaluate the derivative

n : int, default 1

Order of derivative. For 0 returns the Bessel function kv itself.

Returns

out : ndarray

The results

Notes

The derivative is computed using the relation DLFM 10.29.5 [2].

Examples

Compute the modified bessel function of the second kind of order 0 and its first two derivatives at 1.
from scipy.special import kvp
kvp(0, 1, 0), kvp(0, 1, 1), kvp(0, 1, 2)
Compute the first derivative of the modified Bessel function of the second kind for several orders at 1 by providing an array for `v`.
kvp([0, 1, 2], 1, 1)
Compute the first derivative of the modified Bessel function of the second kind of order 0 at several points by providing an array for `z`.
import numpy as np
points = np.array([0.5, 1.5, 3.])
kvp(0, points, 1)
Plot the modified bessel function of the second kind and its first three derivatives.
import matplotlib.pyplot as plt
x = np.linspace(0, 5, 1000)
fig, ax = plt.subplots()
ax.plot(x, kvp(1, x, 0), label=r"$K_1$")
ax.plot(x, kvp(1, x, 1), label=r"$K_1'$")
ax.plot(x, kvp(1, x, 2), label=r"$K_1''$")
ax.plot(x, kvp(1, x, 3), label=r"$K_1'''$")
ax.set_ylim(-2.5, 2.5)
plt.legend()
plt.show()
fig-22695ab55e585020.png

See also

kv

Aliases

  • scipy.special.kvp