本文簡要介紹 python 語言中 scipy.special.struve
的用法。
用法:
scipy.special.struve(v, x, out=None) = <ufunc 'struve'>#
斯特魯維函數。
返回 Struve 階函數的值v在x。 Struve 函數定義為,
其中 是伽馬函數。
- v: array_like
Struve 函數的階數(浮點數)。
- x: array_like
Struve 函數的參數(浮點數;必須為正,除非 v 是整數)。
- out: ndarray,可選
函數結果的可選輸出數組
- H: 標量或 ndarray
v 階 Struve 函數在 x 處的值。
參數 ::
返回 ::
注意:
[1] 中討論的三種方法用於評估 Struve 函數:
動力係列
貝塞爾函數的擴展(如果 )
漸近 large-z 展開(如果 )
根據總和中的最大項估計舍入誤差,並返回與最小誤差相關的結果。
參考:
[1]NIST 數學函數數字 Library https://dlmf.nist.gov/11
例子:
計算 2 階 1 階 Struve 函數。
>>> import numpy as np >>> from scipy.special import struve >>> import matplotlib.pyplot as plt >>> struve(1, 2.) 0.6467637282835622
通過提供階參數 v 的列表,計算階 1、2 和 3 的 Struve 函數在 2 處的值。
>>> struve([1, 2, 3], 2.) array([0.64676373, 0.28031806, 0.08363767])
通過提供 x 的數組,計算多個點的 1 階 Struve 函數。
>>> points = np.array([2., 5., 8.]) >>> struve(1, points) array([0.64676373, 0.80781195, 0.48811605])
通過提供 v 和 z 的數組,在多個點計算多個階的 Struve 函數。數組必須可以廣播為正確的形狀。
>>> orders = np.array([[1], [2], [3]]) >>> points.shape, orders.shape ((3,), (3, 1))
>>> struve(orders, points) array([[0.64676373, 0.80781195, 0.48811605], [0.28031806, 1.56937455, 1.51769363], [0.08363767, 1.50872065, 2.98697513]])
繪製從 -10 到 10 的 0 到 3 階 Struve 函數。
>>> fig, ax = plt.subplots() >>> x = np.linspace(-10., 10., 1000) >>> for i in range(4): ... ax.plot(x, struve(i, x), label=f'$H_{i!r}$') >>> ax.legend(ncol=2) >>> ax.set_xlim(-10, 10) >>> ax.set_title(r"Struve functions $H_{\nu}$") >>> plt.show()
相關用法
- Python SciPy special.stdtr用法及代碼示例
- Python SciPy special.stdtridf用法及代碼示例
- Python SciPy special.stirling2用法及代碼示例
- Python SciPy special.stdtrit用法及代碼示例
- Python SciPy special.smirnovi用法及代碼示例
- Python SciPy special.seterr用法及代碼示例
- Python SciPy special.shichi用法及代碼示例
- Python SciPy special.smirnov用法及代碼示例
- Python SciPy special.softmax用法及代碼示例
- Python SciPy special.sinc用法及代碼示例
- Python SciPy special.sindg用法及代碼示例
- Python SciPy special.spherical_kn用法及代碼示例
- Python SciPy special.spherical_yn用法及代碼示例
- Python SciPy special.sici用法及代碼示例
- Python SciPy special.spherical_in用法及代碼示例
- Python SciPy special.spherical_jn用法及代碼示例
- Python SciPy special.spence用法及代碼示例
- Python SciPy special.exp1用法及代碼示例
- Python SciPy special.expn用法及代碼示例
- Python SciPy special.ncfdtri用法及代碼示例
- Python SciPy special.gamma用法及代碼示例
- Python SciPy special.y1用法及代碼示例
- Python SciPy special.y0用法及代碼示例
- Python SciPy special.ellip_harm_2用法及代碼示例
- Python SciPy special.i1e用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.special.struve。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。