# Python | Numpy np.hermefit() method

With the help of `np.hermefit()` method, we can get the least square fit of hermite series by using `np.hermefit()` method.

Syntax : `np.hermefit(x, y, deg)`
Return : Return the least square fit of given data.

Example #1 :
In this example we can see that by using `np.hermefit()` method, we are able to get the least square fit of hermite series by using this method.

 `# import numpy and hermefit ` `import` `numpy as np ` `from` `numpy.polynomial.hermite_e ``import` `hermefit ` ` `  `x ``=` `np.array([``1``, ``2``, ``3``, ``4``]) ` `y ``=` `np.array([``-``1``, ``-``2``, ``-``3``, ``-``4``]) ` `deg ``=` `3` `# using np.hermefit() method ` `gfg ``=` `hermefit(x, y, deg) ` ` `  `print``(gfg) `

Output :

[6.52513495e-15 -1.00000000e+00 3.34430164e-15 -4.02985428e-16]

Example #2 :

 `# import numpy and hermefit ` `import` `numpy as np ` `from` `numpy.polynomial.hermite_e ``import` `hermefit ` ` `  `x ``=` `np.array([``11``, ``22``, ``33``, ``44``]) ` `y ``=` `np.array([``1``, ``2``, ``3``, ``4``]) ` `deg ``=` `2` `# using np.hermefit() method ` `gfg ``=` `hermefit(x, y, deg) ` ` `  `print``(gfg) `

Output :

[-1.00370716e-15 9.09090909e-02 -5.85610278e-19]

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.