math

  • Special functions of mathematical physics

Calling Sequence

import pyTMD.math
P = pyTMD.math.legendre(2, x, m=0)

Source code

pyTMD.math.polynomial_sum(coefficients: list | ndarray, t: ndarray)[source]

Calculates the sum of a polynomial function using Horner’s method [24]

Parameters:
coefficients: list or np.ndarray

leading coefficient of polynomials of increasing order

t: np.ndarray

delta time in units for a given astronomical longitudes calculation

pyTMD.math.normalize_angle(theta: float | ndarray, circle: float = 360.0)[source]

Normalize an angle to a single rotation

Parameters:
theta: float or np.ndarray

Angle to normalize

circle: float, default 360.0

Circle of the angle

pyTMD.math.rotate(theta: float | ndarray, axis: str = 'x')[source]

Rotate a 3-dimensional matrix about a given axis

Parameters:
theta: float or np.ndarray

Angle of rotation in radians

axis: str, default ‘x’

Axis of rotation ('x', 'y', or 'z')

pyTMD.math.aliasing(f: float, fs: float) float[source]

Calculate the aliasing frequency of a signal

Parameters:
f: float

Frequency of the signal

fs: float

Sampling frequency of the signal

Returns:
fa: float

Aliasing frequency of the signal

pyTMD.math.legendre(l: int, x: ndarray, m: int = 0)[source]

Computes associated Legendre functions for a particular degree and order [23, 35]

Parameters:
l: int

degree of the Legendre polynomials (0 to 3)

x: np.ndarray

elements ranging from -1 to 1

Typically cos(theta), where theta is the colatitude in radians

m: int, default 0

order of the Legendre polynomials (0 to l)

Returns:
Plm: np.ndarray

Legendre polynomials of degree l and order m

pyTMD.math.assoc_legendre(lmax, x)[source]

Computes fully-normalized associated Legendre Polynomials using a standard forward-column method [11] [23]

Parameters:
lmax: int

maximum degree and order of Legendre polynomials

x: np.ndarray

elements ranging from -1 to 1

Typically cos(theta), where theta is the colatitude in radians

Returns:
Plm: np.ndarray

fully-normalized Legendre polynomials

pyTMD.math.sph_harm(l: int, theta: ndarray, phi: ndarray, m: int = 0)[source]

Computes the spherical harmonics for a particular degree and order [23, 35]

Parameters:
l: int

degree of the spherical harmonics (0 to 3)

theta: np.ndarray

colatitude in radians

phi: np.ndarray

longitude in radians

m: int, default 0

order of the spherical harmonics (0 to l)

Returns:
Ylm: np.ndarray

complex spherical harmonics of degree l and order m