Skip to content
Related Articles

Related Articles

Python | Numpy np.hermefit() method
  • Last Updated : 11 Dec, 2019

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

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



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

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

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :