Thursday, October 9, 2025
HomeLanguagesPython | Numpy np.lagtrim() method

Python | Numpy np.lagtrim() method

With the help of np.lagtrim() method, we can trim the small trailing values of the polynomial by using np.lagtrim() method.

Syntax : np.lagtrim(c, tol)
Return : Return the trimmed values from the polynomial.

Example #1 :
In this example we can see that by using np.lagtrim() method, we are able to get the trimmed values of a polynomial by removing trailing values by using this method.




# import numpy and lagtrim
import numpy as np
from numpy.polynomial.laguerre import lagtrim
  
# using np.lagtrim() method
gfg = lagtrim([1, 2, 3, 0, 0], 0)
  
print(gfg)


Output :

[1. 2. 3.]

Example #2 :




# import numpy and lagtrim
import numpy as np
from numpy.polynomial.laguerre import lagtrim
  
# using np.lagtrim() method
gfg = lagtrim([0, 1, 2, 3], 3)
  
print(gfg)


Output :

[0.]

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32345 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6714 POSTS0 COMMENTS
Nicole Veronica
11877 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11940 POSTS0 COMMENTS
Shaida Kate Naidoo
6834 POSTS0 COMMENTS
Ted Musemwa
7094 POSTS0 COMMENTS
Thapelo Manthata
6789 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS