Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Evaluate a 3-D Hermite_e series at points (x,y,z) in Python
To evaluate a 3-D Hermite_e series at points (x, y, z), use the numpy.polynomial.hermite_e.hermeval3d() method. This method evaluates a three-dimensional Hermite_e polynomial series and returns values at the specified coordinate points.
Syntax
numpy.polynomial.hermite_e.hermeval3d(x, y, z, c)
Parameters
x, y, z ? The three-dimensional series is evaluated at points (x, y, z). These arrays must have the same shape. If any parameter is a list or tuple, it is converted to an ndarray.
c ? Array of coefficients ordered so that the coefficient of the term of multi-degree i,j,k is contained in c[i,j,k]. If c has dimension greater than 3, the remaining indices enumerate multiple sets of coefficients.
Example
Let's create a 3-D coefficient array and evaluate the Hermite_e series at specific points −
import numpy as np
from numpy.polynomial import hermite_e as H
# Create a 3d array of coefficients
c = np.arange(24).reshape(2, 2, 6)
# Display the coefficient array
print("Coefficient Array:")
print(c)
# Check array properties
print(f"\nDimensions: {c.ndim}")
print(f"Shape: {c.shape}")
print(f"Datatype: {c.dtype}")
# Evaluate 3D Hermite_e series at points (1,2), (1,2), (1,2)
result = H.hermeval3d([1, 2], [1, 2], [1, 2], c)
print(f"\nEvaluation at points ([1,2], [1,2], [1,2]):")
print(result)
Coefficient Array: [[[ 0 1 2 3 4 5] [ 6 7 8 9 10 11]] [[12 13 14 15 16 17] [18 19 20 21 22 23]]] Dimensions: 3 Shape: (2, 2, 6) Datatype: int64 Evaluation at points ([1,2], [1,2], [1,2]): [ 212. -2484.]
Different Point Combinations
You can also evaluate at different coordinate combinations −
import numpy as np
from numpy.polynomial import hermite_e as H
# Create coefficient array
c = np.arange(8).reshape(2, 2, 2)
print("Coefficient Array:")
print(c)
# Evaluate at multiple point combinations
x = [0, 1]
y = [0, 1]
z = [0, 1]
result = H.hermeval3d(x, y, z, c)
print(f"\nEvaluation at points ({x}, {y}, {z}):")
print(result)
# Single point evaluation
single_result = H.hermeval3d(1, 1, 1, c)
print(f"\nEvaluation at single point (1, 1, 1): {single_result}")
Coefficient Array: [[[0 1] [2 3]] [[4 5] [6 7]]] Evaluation at points ([0, 1], [0, 1], [0, 1]): [0. 6.] Evaluation at single point (1, 1, 1): 6.0
Conclusion
The hermeval3d() method provides an efficient way to evaluate 3-D Hermite_e polynomial series at specified coordinate points. The coefficient array structure determines the polynomial terms, and the method handles both single points and arrays of coordinates.
