Open In App

Python | Numpy np.hermecompanion() method

Last Updated : 11 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of np.hermecompanion() method, we can get the companion matrix of hermiteE series by using np.hermecompanion() method.

Syntax : np.hermecompanion(series)
Return : Return the companion matrix.

Example #1 :
In this example we can see that by using np.hermecompanion() method, we are able to get the companion matrix from hermiteE series by using this method.




# import numpy and hermecompanion
import numpy as np
from numpy.polynomial.hermite_e import hermecompanion
   
series = np.array([6, 7, 8, 9, 10])
# using np.hermecompanion() method
gfg = hermecompanion(series)
   
print(gfg)


Output :

[[ 0. 1. 0. -0.24494897]
[ 1. 0. 1.41421356 -0.2857738 ]
[ 0. 1.41421356 0. 1.27017059]
[ 0. 0. 1.73205081 -0.9 ]]

Example #2 :




# import numpy and hermecompanion
import numpy as np
from numpy.polynomial.hermite_e import hermecompanion
   
series = np.array([1, 2, 3, 4, 5])
# using np.hermecompanion() method
gfg = hermecompanion(series)
   
print(gfg)


Output :

[[ 0. 1. 0. -0.08164966]
[ 1. 0. 1.41421356 -0.16329932]
[ 0. 1.41421356 0. 1.38564065]
[ 0. 0. 1.73205081 -0.8 ]]


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads