# Python | Numpy np.hermecompanion() method

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 ]]

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.