yasfpy.functions.legendre_normalized_trigon#

Normalized associated Legendre functions (trigonometric form).

Provides helpers used in spherical-harmonic related computations.

Functions#

legendre_normalized_trigon(lmax, x[, y])

Compute the normalized Legendre polynomials of the first kind for trigonometric arguments.

legendre_normalized_trigon_legacy(x[, y, lmax])

Calculate the normalized Legendre polynomials for trigonometric functions.

Module Contents#

yasfpy.functions.legendre_normalized_trigon.legendre_normalized_trigon(lmax, x, y=None)#

Compute the normalized Legendre polynomials of the first kind for trigonometric arguments.

Parameters:
  • lmax (int) – The maximum degree of the Legendre polynomials.

  • x (np.ndarray) – The input array of x-coordinates.

  • y (np.ndarray, optional) – The input array of y-coordinates. Defaults to None.

Returns:

The array of computed Legendre polynomials.

Return type:

plm (np.ndarray)

Note

Base on the celes implementation of [legendre_normalized_trigon.m](disordered-photonics/celes){:target=”_blank”}

Examples

>>> lmax = 2
>>> x = np.array([0, np.pi/4, np.pi/2])
>>> y = np.array([0, 1, 0])
>>> result = legendre_normalized_trigon(lmax, x, y)
>>> print(result)
array([[[ 0.70710678,  0.        ,  0.        ],
        [ 0.        ,  0.        ,  0.        ],
        [ 0.        ,  0.        ,  0.        ]],
       [[ 0.        ,  0.        ,  0.        ],
        [ 0.        ,  0.70710678,  0.        ],
        [ 0.        ,  0.        ,  0.        ]],
       [[ 0.        ,  0.        ,  0.        ],
        [ 0.        ,  0.        ,  0.        ],
        [ 0.        ,  0.        ,  0.70710678]]])
yasfpy.functions.legendre_normalized_trigon.legendre_normalized_trigon_legacy(x, y=None, lmax=4)#

Calculate the normalized Legendre polynomials for trigonometric functions.

Parameters:
  • x (float or sympy.core.symbol.Symbol) – The input variable x.

  • y (float or sympy.core.symbol.Symbol, optional) – The input variable y. Defaults to None.

  • lmax (int, optional) – The maximum degree of the Legendre polynomials. Defaults to 4.

Returns:

The matrix of Legendre polynomials.

Return type:

plm (numpy.ndarray)