pyoptools.misc.function_2d.poly_r.poly_r module

class pyoptools.misc.function_2d.poly_r.poly_r.PolyR

Bases: Function2D

A 2D polynomial class for radially symmetric functions.

Represents polynomials that depend only on the radial distance r = x**2 + y**2 from the origin. While the polynomial is defined in terms of r, it can be evaluated at any point (x,y) in Cartesian coordinates.

The polynomial is expressed in terms of r as: z = c_0 + c_1*r + c_2*r^2 + c_3*r^3 + … + c_n*r^n

where r = x**2 + y**2

Parameters:

coeff (array_like) – List or array of polynomial coefficients in ascending order of degree. The length of coeff determines the order of the polynomial.

order

The order (degree) of the polynomial.

Type:

int

_coeff

Internal Eigen vector storing the polynomial coefficients.

Type:

VectorXd

dx

Derivative with respect to x, computed lazily.

Type:

PolyRDeriv or None

dy

Derivative with respect to y, computed lazily.

Type:

PolyRDeriv or None

dx
dxdy()

Compute the partial derivatives with respect to x and y.

Returns:

A tuple (dx, dy) containing the derivative polynomials:
  • dx: derivative with respect to x

  • dy: derivative with respect to y

Return type:

tuple of PolyRDeriv

dy
eval(x, y)

Evaluate the polynomial at arrays of coordinates (x,y).

Parameters:
  • x (ndarray) – 2D array of x coordinates, shape (n_rows, n_cols).

  • y (ndarray) – 2D array of y coordinates, shape (n_rows, n_cols).

Returns:

2D array containing the polynomial values at each (x,y) point, shape matches input arrays.

Return type:

ndarray

order