Python | Numpy np.hermevander3d () method

NumPy | Python Methods and Functions

With the np.hermevander3d () method, we can get the Vandermonde pseudo-matrix for 3D data that has degrees x, y and z using np.hermevander3d () .

Syntax: np.hermevander3d (x, y, z, [x_deg, y_deg, z_deg])

Return: Return the pseudo vandermonde matrix of given 3-D data.

Example # 1:
In this example, we can see that with np.hermevander3d () we can get a pseudo-vander matrix of 3D data that has degree (x, y, z), with using this method.

# import numpy and hermevander3d

import numpy as np

from numpy.polynomial.hermit e_e import hermevander3d

  

x = np.array ([ 1 , 0.1 ])

y = np.array ([ 2 , 0.2 ])

z = np. array ([ 3 , 0.3 ])

x_deg, y_deg, z_deg = 2 , 3 , 1

 
# using the np.hermevander3d method ()

gfg = hermevander3d (x , y, z, [x_deg, y_deg, z_deg])

 

print (gfg)

Output:

[[1.00000e + 00 3.00000e + 00 2.00000e + 00 6.00000e + 00 3.00000e + 00
9.00000e + 00 2.00000e + 00 6.00000e + 00 1.00000e + 00 3.00000e + 00
2.00000e + 00 6.00000e + 00 3.00000e + 00 9.00000e + 00 2.00000e + 00
6.00000 e + 00 0.00000e + 00 0.00000e + 00 0.00000e + 00 0.00000e + 00
0.00000e + 00 0.00000e + 00 0.00000e + 00 0.00000e + 00]
[1.00000e + 00 3.00000 e-01 2.00000e-01 6.00000e-02 -9.60000e-01
-2.88000e-01 -5.92000e-01 -1.77600e-01 1.00000e-01 3.00000e-02
2.00000e- 02 6.00000e-03 -9.60000e-02 -2.88000e-02 -5.92000e-02
-1.77600e-02 -9.90000e-01 -2.97000e-01 -1.98000e-01 -5.94000e-02
9.50400e-01 2.85120e- 01 5.86080e-01 1.75824e-01]]

Example # 2:

# import numpy and hermevander3d

import numpy as np

from numpy.polynomial.hermite_e import hermevander3d

  

x = np.array ([ 1.01 , 2.02 , 3.03 ])

y = np.array ([ 10.1 , 20.2 , 30.3 ])

z = np. array ([ 0.1 , 0.2 , 0.3 ])

x_deg, y_deg, z_deg = 1 , 1 , 3

  
# using the np.hermevander3d () method

gfg = hermevander3d (x, y, z, [x_deg, y_deg, z_deg])

 

print (gfg)

Exit :

[[1. 0.1 -0.99 -0.299 10.1 1.01
-9.999 -3.0199 1.01 0.101 -0.9999 -0.30199
10.201 1.0201 -10.09899 -3.050099 ]
[1. 0.2 -0.96 -0.592 20.2 4.04
-19.392 -11.9584 2.02 0.404 -1.9392 -1.19584
40.804 8.1608 -39.17184 -24.155968]
[1. 0.3 -0.91 -0.873 30.3 9.09
-27.573 -26.4519 3.03 0.909 -2.7573 -2.64519
91.809 27.5427 -83.54619 -80.149257]]





Get Solution for free from DataCamp guru