scipy.integrate.
lebedev_rule#
- scipy.integrate.lebedev_rule(n)[source]#
Lebedev 正交積分。
計算 Lebedev 正交積分的取樣點與權重 [1],用於在單位球體表面積分函數。
- 參數:
- nint
正交積分階數。請參閱「註解」以了解支援的值。
- 回傳值:
- xndarray of shape
(3, m)
單位球體在笛卡爾座標系上的取樣點。
m
是對應於指定階數的「度數」;請參閱「註解」。- wndarray of shape
(m,)
權重
- xndarray of shape
註解
透過將 [2] 的 Matlab 程式碼翻譯成 Python 來實作。
可用的階數(參數 n)為
3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131
對應的度數
m
為6, 14, 26, 38, 50, 74, 86, 110, 146, 170, 194, 230, 266, 302, 350, 434, 590, 770, 974, 1202, 1454, 1730, 2030, 2354, 2702, 3074, 3470, 3890, 4334, 4802, 5294, 5810
參考文獻
[1]V.I. Lebedev 和 D.N. Laikov。「精度為代數 131 階的球體正交公式」。Doklady Mathematics,第 59 卷,第 3 期,1999 年,第 477-481 頁。
[2]R. Parrish。
getLebedevSphere
。Matlab Central File Exchange。https://www.mathworks.com/matlabcentral/fileexchange/27097-getlebedevsphere。[3]Bellet, Jean-Baptiste、Matthieu Brachet 和 Jean-Pierre Croisille。「立方球體上的正交積分與對稱性。」Journal of Computational and Applied Mathematics 409 (2022): 114142。DOI:10.1016/j.cam.2022.114142。
範例
在 [3] 中給出的範例是在半徑為 \(1\) 的球體上積分 \(f(x, y, z) = \exp(x)\);該處的參考值為
14.7680137457653
。顯示隨著階數增加,結果收斂到預期值>>> import matplotlib.pyplot as plt >>> import numpy as np >>> from scipy.integrate import lebedev_rule >>> >>> def f(x): ... return np.exp(x[0]) >>> >>> res = [] >>> orders = np.arange(3, 20, 2) >>> for n in orders: ... x, w = lebedev_rule(n) ... res.append(w @ f(x)) >>> >>> ref = np.full_like(res, 14.7680137457653) >>> err = abs(res - ref)/abs(ref) >>> plt.semilogy(orders, err) >>> plt.xlabel('order $n$') >>> plt.ylabel('relative error') >>> plt.title(r'Convergence for $f(x, y, z) = \exp(x)$') >>> plt.show()