📜  Python| Numpy 多项式 legint() 方法

📅  最后修改于: 2022-05-13 01:54:49.840000             🧑  作者: Mango

Python| Numpy 多项式 legint() 方法

np.legint()方法用于整合勒让德系列

代码#1:

# Python program explaining 
# numpy.legint() method  
      
# importing numpy as np   
# and numpy.polynomial.legendre module as geek  
import numpy as np  
import numpy.polynomial.legendre as geek 
      
# Legendre series coefficients 
    
s1 = (2, 4, 8)  
      
# using np.legint() method  
res = geek.legint(s1)  
    
# Resulting legendre series 
print (res)  
输出:
[ 0.66666667  0.4         1.33333333  1.6       ]

代码#2:

# Python program explaining 
# numpy.legint() method  
      
# importing numpy as np   
# and numpy.polynomial.legendre module as geek  
import numpy as np  
import numpy.polynomial.legendre as geek 
      
# Legendre series coefficients 
    
s1 = (10, 20, 30, 40, 50)  
      
# using np.legint() method  
res = geek.legint(s1)  
    
# Resulting legendre series 
print (res)
输出:
[-1.66666667  4.          0.95238095  0.44444444  5.71428571  5.55555556]