This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / special / _basic / kvp

function

scipy.special._basic:kvp

source: build-install/usr/lib/python3.14/site-packages/scipy/special/_basic.py:978

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)
✗
(np.float64(0.42102443824070834), np.float64(-0.6019072301972346), np.float64(1.0229316684379428))
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)
✗
array([-0.602, -1.023, -3.852])
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)
✗
array([-1.656, -0.277, -0.04 ])
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()
✗
<matplotlib.legend.Legend object at 0x7f3f68aeeba0>
plt.show()
✓
fig-ae1f271e264c3dc7.png

See also

kv

Aliases

  • scipy.special.kvp