Evaluate a 2-D Hermite_e series at points (x,y) with 1D array of coefficient in Python

To evaluate a 2D Hermite_e series at points (x, y), use the hermeval2d() method from NumPy's polynomial module. This function evaluates a two-dimensional Hermite_e polynomial at specified coordinate pairs and returns the corresponding values.

Syntax

numpy.polynomial.hermite_e.hermeval2d(x, y, c)

Parameters

The function accepts three parameters:

  • x, y: The coordinate arrays where the polynomial is evaluated. They must have the same shape.
  • c: Array of coefficients ordered so that the coefficient of term with multi-degree i,j is in c[i,j].

Example

Let's create a 1D coefficient array and evaluate the 2D Hermite_e series ?

import numpy as np
from numpy.polynomial import hermite_e as H

# Create a 1D array of coefficients
c = np.array([3, 5])

# Display the array
print("Our Array...")
print(c)

# Check the dimensions
print("\nDimensions of our Array...")
print(c.ndim)

# Get the datatype
print("\nDatatype of our Array object...")
print(c.dtype)

# Get the shape
print("\nShape of our Array object...")
print(c.shape)
Our Array...
[3 5]

Dimensions of our Array...
1

Datatype of our Array object...
int64

Shape of our Array object...
(2,)

Evaluating the 2D Hermite_e Series

Now we evaluate the series at coordinate points (1,1) and (2,2) ?

import numpy as np
from numpy.polynomial import hermite_e as H

c = np.array([3, 5])

# Evaluate 2D Hermite_e series at points (x,y)
result = H.hermeval2d([1, 2], [1, 2], c)
print("Result...")
print(result)
Result...
[21. 34.]

How It Works

The hermeval2d() function evaluates the 2D polynomial using the coefficient array. For a 1D coefficient array [3, 5], the function treats it as coefficients for a 2D polynomial where:

  • The coefficient 3 corresponds to the constant term
  • The coefficient 5 corresponds to higher-degree terms
  • The evaluation combines x and y coordinates according to Hermite_e polynomial rules

Conclusion

The hermeval2d() function provides an efficient way to evaluate 2D Hermite_e series at multiple coordinate pairs simultaneously. It's particularly useful for mathematical computations involving orthogonal polynomials in two dimensions.

Updated on: 2026-03-26T21:10:22+05:30

233 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements