benchmarkfcns.plotting.meshgrid

benchmarkfcns.plotting.meshgrid(x, y, fcn)[source]

Create a meshgrid of points for a given function. The function is evaluated at each point of the grid and the resulting function values are returned. To evaluate the points of the grid, the function is vectorised and the function values are calculated in a single function call, instead of calculating the function value for each point.

Return type:

tuple[ndarray, ndarray, ndarray]

Parameters:

xnp.ndarray or list

1D array of x values.

ynp.ndarray or list

1D array of y values.

fcncallable

Function to evaluate at each point of the grid. The function should accept a 2D array of points as input and return a 1D array of function values.

Returns:

: X : np.ndarray

2D array of x values, represeting the x-coordinates of the grid points.

Ynp.ndarray

2D array of y values, represeting the y-coordinates of the grid points.

Znp.ndarray

2D array of function values obtained from fcn for each point in the grid.

Mathematical Definition

Visualization

meshgrid landscape