np.laggauss()
計算Gauss-Laguerre正交的采樣點和權重。這些采樣點和權重將正確積分度的多項式2*deg - 1
在間隔內或更少[0, inf]
配重函數f(x) = exp(-x)
用法:np.laggauss(deg)
參數:
deg :[int] Number of sample points and weights. It must be >= 1.
返回:1. [ndarray]包含樣本點的一維ndarray。
2. [ndarray]包含權重的一維ndarray。
代碼1:
# Python program explaining
# numpy.laggauss() method
# importing numpy as np
# and numpy.polynomial.laguerre module as geek
import numpy as np
import numpy.polynomial.laguerre as geek
# Input degree = 2
degree = 2
# using np.laggauss() method
res = geek.laggauss(degree)
# Resulting array of sample point and weight
print (res)
輸出:
(array([ 0.58578644, 3.41421356]), array([ 0.85355339, 0.14644661]))
代碼2:
# Python program explaining
# numpy.laggauss() method
# importing numpy as np
# and numpy.polynomial.laguerre module as geek
import numpy as np
import numpy.polynomial.laguerre as geek
# Input degree
degree = 3
# using np.laggauss() method
res = geek.laggauss(degree)
# Resulting array of sample point and weight
print (res)
輸出:
(array([ 0.41577456, 2.29428036, 6.28994508]), array([ 0.71109301, 0.27851773, 0.01038926]))
相關用法
- Python Numpy np.fft()用法及代碼示例
- Python numpy.ma.ids()用法及代碼示例
- Python Numpy np.hermeroots()用法及代碼示例
- Python Numpy np.lagvander()用法及代碼示例
- Python Numpy np.lagadd()用法及代碼示例
- Python Numpy np.lagdiv()用法及代碼示例
- Python Numpy np.lagsub()用法及代碼示例
- Python Numpy np.lagmul()用法及代碼示例
- Python Numpy np.hermegrid2d()用法及代碼示例
- Python Numpy np.lagone()用法及代碼示例
- Python Numpy np.lagzero()用法及代碼示例
- Python Numpy np.lagcompanion()用法及代碼示例
- Python Numpy np.lag2poly()用法及代碼示例
- Python Numpy np.hermegrid3d()用法及代碼示例
- Python Numpy np.hermefromroots()用法及代碼示例
注:本文由純淨天空篩選整理自jana_sayantan大神的英文原創作品 Python | Numpy np.laggauss() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。