Hermite बहुपद और x, y, z नमूना बिंदुओं का छद्म वेंडरमोंड मैट्रिक्स उत्पन्न करने के लिए, Python Numpy में hermite.hermvander3d() का उपयोग करें। विधि छद्म-वेंडरमोंडेमेट्रिक्स लौटाती है। पैरामीटर, x, y, z बिंदु निर्देशांक के सरणियाँ हैं, सभी एक ही आकार के हैं। तत्वों में से कोई भी जटिल है या नहीं, इस पर निर्भर करते हुए dtypes को या तो float64 या complex128 में बदल दिया जाएगा। स्केलर को 1-डी सरणियों में बदल दिया जाता है। पैरामीटर, डिग्री [x_deg, y_deg, z_deg] फॉर्म की अधिकतम डिग्री की सूची है।
कदम
सबसे पहले, आवश्यक पुस्तकालय आयात करें -
numpy as np from numpy.polynomial import hermite as H
numpy.array() विधि का उपयोग करके बिंदु निर्देशांकों की सरणियाँ बनाएँ, सभी समान आकार की -
x = np.array([-2.+2.j, -1.+2.j]) y = np.array([0.+2.j, 1.+2.j]) z = np.array([2.+2.j, 3. + 3.j])
सरणियों को प्रदर्शित करें -
print("Array1...\n",x) print("\nArray2...\n",y) print("\nArray3...\n",z)
डेटाटाइप प्रदर्शित करें -
print("\nArray1 datatype...\n",x.dtype) print("\nArray2 datatype...\n",y.dtype) print("\nArray3 datatype...\n",z.dtype)
दोनों सरणियों के आयामों की जाँच करें -
print("\nDimensions of Array1...\n",x.ndim) print("\nDimensions of Array2...\n",y.ndim) print("\nDimensions of Array3...\n",z.ndim)
दोनों सरणियों के आकार की जाँच करें -
print("\nShape of Array1...\n",x.shape) print("\nShape of Array2...\n",y.shape) print("\nShape of Array3...\n",z.shape)
हरमाइट बहुपद और x, y, z नमूना बिंदुओं का छद्म वेंडरमोंड मैट्रिक्स उत्पन्न करने के लिए, hermite.hermvander3d() -
का उपयोग करें।x_deg, y_deg, z_deg = 2, 3, 4 print("\nResult...\n",H.hermvander3d(x,y,z, [x_deg, y_deg, z_deg]))
उदाहरण
import numpy as np from numpy.polynomial import hermite as H # Create arrays of point coordinates, all of the same shape using the numpy.array() method x = np.array([-2.+2.j, -1.+2.j]) y = np.array([0.+2.j, 1.+2.j]) z = np.array([2.+2.j, 3. + 3.j]) # Display the arrays print("Array1...\n",x) print("\nArray2...\n",y) print("\nArray3...\n",z) # Display the datatype print("\nArray1 datatype...\n",x.dtype) print("\nArray2 datatype...\n",y.dtype) print("\nArray3 datatype...\n",z.dtype) # Check the Dimensions of both the arrays print("\nDimensions of Array1...\n",x.ndim) print("\nDimensions of Array2...\n",y.ndim) print("\nDimensions of Array3...\n",z.ndim) # Check the Shape of both the arrays print("\nShape of Array1...\n",x.shape) print("\nShape of Array2...\n",y.shape) print("\nShape of Array3...\n",z.shape) # To generate a pseudo Vandermonde matrix of the Hermite polynomial and x, y, z sample points, use the hermite.hermvander3d() in Python Numpy x_deg, y_deg, z_deg = 2, 3, 4 print("\nResult...\n",H.hermvander3d(x,y,z, [x_deg, y_deg, z_deg]))
आउटपुट
Array1... [-2.+2.j -1.+2.j] Array2... [0.+2.j 1.+2.j] Array3... [2.+2.j 3.+3.j] Array1 datatype... complex128 Array2 datatype... complex128 Array3 datatype... complex128 Dimensions of Array1... 1 Dimensions of Array2... 1 Dimensions of Array3... 1 Shape of Array1... (2,) Shape of Array2... (2,) Shape of Array3... (2,) Result... [[ 1.000000e+00+0.000000e+00j 4.000000e+00+4.000000e+00j -2.000000e+00+3.200000e+01j -1.520000e+02+1.040000e+02j -1.012000e+03-3.840000e+02j 0.000000e+00+4.000000e+00j -1.600000e+01+1.600000e+01j -1.280000e+02-8.000000e+00j -4.160000e+02-6.080000e+02j 1.536000e+03-4.048000e+03j -1.800000e+01+0.000000e+00j -7.200000e+01-7.200000e+01j 3.600000e+01-5.760000e+02j 2.736000e+03-1.872000e+03j 1.821600e+04+6.912000e+03j 0.000000e+00-8.800000e+01j 3.520000e+02-3.520000e+02j 2.816000e+03+1.760000e+02j 9.152000e+03+1.337600e+04j -3.379200e+04+8.905600e+04j -4.000000e+00+4.000000e+00j -3.200000e+01+0.000000e+00j -1.200000e+02-1.360000e+02j 1.920000e+02-1.024000e+03j 5.584000e+03-2.512000e+03j -1.600000e+01-1.600000e+01j 0.000000e+00-1.280000e+02j 5.440000e+02-4.800000e+02j 4.096000e+03+7.680000e+02j 1.004800e+04+2.233600e+04j 7.200000e+01-7.200000e+01j 5.760000e+02+0.000000e+00j 2.160000e+03+2.448000e+03j -3.456000e+03+1.843200e+04j -1.005120e+05+4.521600e+04j 3.520000e+02+3.520000e+02j 0.000000e+00+2.816000e+03j -1.196800e+04+1.056000e+04j -9.011200e+04-1.689600e+04j -2.210560e+05-4.913920e+05j -2.000000e+00-3.200000e+01j 1.200000e+02-1.360000e+02j 1.028000e+03+0.000000e+00j 3.632000e+03+4.656000e+03j -1.026400e+04+3.315200e+04j 1.280000e+02-8.000000e+00j 5.440000e+02+4.800000e+02j 0.000000e+00+4.112000e+03j -1.862400e+04+1.452800e+04j -1.326080e+05-4.105600e+04j 3.600000e+01+5.760000e+02j -2.160000e+03+2.448000e+03j -1.850400e+04+0.000000e+00j -6.537600e+04-8.380800e+04j 1.847520e+05-5.967360e+05j -2.816000e+03+1.760000e+02j -1.196800e+04-1.056000e+04j 0.000000e+00-9.046400e+04j 4.097280e+05-3.196160e+05j 2.917376e+06+9.032320e+05j] [ 1.000000e+00+0.000000e+00j 6.000000e+00+6.000000e+00j -2.000000e+00+7.200000e+01j -4.680000e+02+3.960000e+02j -5.172000e+03-8.640000e+02j 2.000000e+00+4.000000e+00j -1.200000e+01+3.600000e+01j -2.920000e+02+1.360000e+02j -2.520000e+03-1.080000e+03j -6.888000e+03-2.241600e+04j -1.400000e+01+1.600000e+01j -1.800000e+02+1.200000e+01j -1.124000e+03-1.040000e+03j 2.160000e+02-1.303200e+04j 8.623200e+04-7.065600e+04j -1.000000e+02-4.000000e+01j -3.600000e+02-8.400000e+02j 3.080000e+03-7.120000e+03j 6.264000e+04-2.088000e+04j 4.826400e+05+2.932800e+05j -2.000000e+00+4.000000e+00j -3.600000e+01+1.200000e+01j -2.840000e+02-1.520000e+02j -6.480000e+02-2.664000e+03j 1.380000e+04-1.896000e+04j -2.000000e+01+0.000000e+00j -1.200000e+02-1.200000e+02j 4.000000e+01-1.440000e+03j 9.360000e+03-7.920000e+03j 1.034400e+05+1.728000e+04j -3.600000e+01-8.800000e+01j 3.120000e+02-7.440000e+02j 6.408000e+03-2.416000e+03j 5.169600e+04+2.692800e+04j 1.101600e+05+4.862400e+05j 3.600000e+02-3.200000e+02j 4.080000e+03+2.400000e+02j 2.232000e+04+2.656000e+04j -4.176000e+04+2.923200e+05j -2.138400e+06+1.344000e+06j -1.400000e+01-1.600000e+01j 1.200000e+01-1.800000e+02j 1.180000e+03-9.760000e+02j 1.288800e+04+1.944000e+03j 5.858400e+04+9.484800e+04j 3.600000e+01-8.800000e+01j 7.440000e+02-3.120000e+02j 6.264000e+03+2.768000e+03j 1.800000e+04+5.544000e+04j -2.622240e+05+4.240320e+05j 4.520000e+02+0.000000e+00j 2.712000e+03+2.712000e+03j -9.040000e+02+3.254400e+04j -2.115360e+05+1.789920e+05j -2.337744e+06-3.905280e+05j 7.600000e+02+2.160000e+03j -8.400000e+03+1.752000e+04j -1.570400e+05+5.040000e+04j -1.211040e+06-7.099200e+05j -2.064480e+06-1.182816e+07j]]