polynomials

Polynomials used in recursivenodes.

recursivenodes.polynomials.jacobi(n, x, a=0.0, b=0.0, out=None)[source]

Evaluation of a Jacobi polynomial.

Parameters
  • n (int) – The degree of the polynomial.

  • x (ndarray) – Points at which to evaluate the polynomial.

  • a (float, optional) – Left exponent of weight function.

  • b (float, optional) – Right exponent of weight function.

  • out (ndarray, optional) – Output placed here if given, same shape as x.

Returns

same shape as x, values of the \(n\)-th Jacobi polynomials with respect to the weight function \((1+x)^a(1-x)^b\) at the points in x.

Return type

ndarray

recursivenodes.polynomials.jacobider(n, x, a=0.0, b=0.0, k=1, out=None)[source]

Evaluation of a the \(k\)-th derivative of a Jacobi polynomial.

Parameters
  • n (int) – The degree of the polynomial.

  • x (ndarray) – Points at which to evaluate the polynomial.

  • a (float, optional) – Left exponent of weight function.

  • b (float, optional) – Right exponent of weight function.

  • out (ndarray, optional) – Output placed here if given, same shape as x.

Returns

same shape as x, values of the \(k\)-th derivative of the \(n\)-th Jacobi polynomials with respect to the weight function \((1+x)^a(1-x)^b\) at the points in x.

Return type

ndarray

recursivenodes.polynomials.jacobinorm2(n, a=0.0, b=0.0)[source]

The square of the weighted \(L_2\) norm of a Jacobi polynomial.

Parameters
  • n (int) – The degree of the polynomial.

  • x (ndarray) – Points at which to evaluate the polynomial.

  • a (float, optional) – Left exponent of weight function.

  • b (float, optional) – Right exponent of weight function.

Returns

\(\int_{-1}^1 (1+x)^a (1-x)^b P^{(a,b)}_n(x)^2\ dx\).

Return type

float

recursivenodes.polynomials.proriolkoornwinderdubiner(d, i, x, out=None)[source]

Evaluation of a Proriol-Koornwinder-Dubiner (PKD) polynomial.

Parameters
  • d (int) – The spatial dimension.

  • i (tuple(int)) – Multi-index of length \(d\), the degree of the leading monomial of the PKD polynomial in each spatial coordinate.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial.

  • out (ndarray, optional) – Shape (\(N\),) array to hold output.

Returns

Shape (\(N\),), evaluation of the PKD polynomial with leading monomial degrees \(i\) at the points \(x\). The PKD polynomials are orthonormal on the biunit simplex.

Return type

ndarray

References

[Pro57][KM64][Koo75][Dub91]

recursivenodes.polynomials.proriolkoornwinderdubinergrad(d, i, x, out=None, both=False)[source]

Evaluation of the gradient of a Proriol-Koornwinder-Dubiner (PKD) polynomial.

Parameters
  • d (int) – The spatial dimension.

  • i (tuple(int)) – Multi-index of length \(d\), the degree of the leading monomial of the PKD polynomial in each spatial coordinate.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial.

  • out (ndarray, optional) – Shape (\(N\), \(d\)) array to hold output.

  • both – (bool, optional): If True, return both the function value and gradient.

Returns

If both=False, an ndarray with shape (\(N\), \(d\)) containing the gradient of the PKD polynomial with leading monomial degrees \(i\) at the points \(x\).

If both=True, a tuple containing two ndarrays, one for the functional value and one for its gradient, in that order.

recursivenodes.polynomials.proriolkoornwinderdubinerhess(d, i, x)[source]

Evaluation of the gradient of a Proriol-Koornwinder-Dubiner (PKD) polynomial.

Parameters
  • d (int) – The spatial dimension.

  • i (tuple(int)) – Multi-index of length \(d\), the degree of the leading monomial of the PKD polynomial in each spatial coordinate.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial.

Returns

Shape (\(N\), \(d\), \(d\)) containing the Hessian of the PKD polynomial with leading monomial degrees \(i\) at the points \(x\).

Return type

ndarray

recursivenodes.polynomials.proriolkoornwinderdubinervandermonde(d, n, x, out=None, C=None)[source]

Evaluation of the Vandermonde matrix of the Proriol-Koornwinder-Dubiner (PKD) polynomials.

Parameters
  • d (int) – The spatial dimension.

  • n (int) – The maximum degree of polynomials to include in the Vandermonde matrix.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial Vandermonde matrix.

  • out (ndarray, optional) – Shape (\(N\), \(\binom{n+d}{d}\)) array to hold output (or, if C is given, shape (\(N\), \(M\)), where \(M\) is the number of columns of \(C\)).

  • C (ndarray, optional) – Shape (\(\binom{n+d}{d}\), \(M\)) matrix to multiply the PDK Vandermonde matrix by on the right.

Returns

Shape (\(N\), \(\binom{n+d}{d}\)), evaluation of the PKD polynomials with leading monomial degree at most \(n\) at the points \(x\). The columns will index the PKD polynomials in lexicographic degree of their leading monomial exponents.

Or, if \(C\) is given, shape (\(N\), \(M\)), the product of the Vandermonde matrix with \(C\).

Return type

ndarray

recursivenodes.polynomials.proriolkoornwinderdubinervandermondegrad(d, n, x, out=None, C=None, work=None, both=False)[source]

Evaluation of the gradient of the Vandermonde matrix of the Proriol-Koornwinder-Dubiner (PKD) polynomials.

Parameters
  • d (int) – The spatial dimension.

  • n (int) – The maximum degree of polynomials to include in the Vandermonde matrix.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial Vandermonde matrix.

  • out (ndarray, optional) – Shape (\(N\), \(\binom{n+d}{d}\), \(d\)) array to hold output (or, if C is given, shape (\(N\), \(M\), \(d\)), where \(M\) is the number of columns of \(C\)).

  • C (ndarray, optional) – Shape (\(\binom{n+d}{d}\), \(M\)) matrix to multiply the PDK Vandermonde matrix by on the right.

Returns

Shape (\(N\), \(\binom{n+d}{d}\), \(d\)), evaluation of the gradient of the PKD Vandermonde matrix at the points \(x\).

Or, if \(C\) is given, shape (\(N\), \(M\), \(d\)), the gradient of the product of the Vandermonde matrix with \(C\).

Return type

ndarray

recursivenodes.polynomials.proriolkoornwinderdubinervandermondehess(d, n, x, C=None)[source]

Evaluation of the Hessian of the Vandermonde matrix of the Proriol-Koornwinder-Dubiner (PKD) polynomials.

Parameters
  • d (int) – The spatial dimension.

  • n (int) – The maximum degree of polynomials to include in the Vandermonde matrix.

  • x (ndarray) – Shape (\(N\), \(d\)), points at which to evaluate the PDK polynomial Vandermonde matrix.

  • C (ndarray, optional) – Shape (\(\binom{n+d}{d}\), \(M\)) matrix to multiply the PDK Vandermonde matrix by on the right.

Returns

Shape (\(N\), \(\binom{n+d}{d}\), \(d\), \(d\)), evaluation of the Hessian of the PKD Vandermonde matrix at the points \(x\).

Or, if \(C\) is given, shape (\(N\), \(M\), \(d\)), the Hessian of the product of the Vandermonde matrix with \(C\).

Return type

ndarray