pykbe.gregory module#
- pykbe.gregory.conv_integral_r(m, k)[source]#
Double-precision version of
conv_integral_r_exact.- Parameters:
- Returns:
- R(k+1, k+1)
ndarray Equation 104 weights for fixed m, k
- R(k+1, k+1)
See also
conv_integral_r_exactExact version
- pykbe.gregory.conv_integral_r_exact(m, k)[source]#
Equation 104 [NESSI].
\[R^{(k)}_{m;r,s} = \sum_{a,b=0}^k P^{(k)}_{ar} P^{(k)}_{bs} \int_0^m (m-x)^a x^b \, dx\]
- pykbe.gregory.gregory_coef(k)[source]#
Gregory coefficients.
See https://en.wikipedia.org/wiki/Gregory_coefficients.
Starting from \(G_0\), the first few coefficients are: \(-\frac{1}{2}, \frac{1}{12}, -\frac{1}{24}, \frac{19}{720}, \ldots\)
\[G_k = \frac{-1}{(k+1)!} \left[ \frac{d^{k+1}}{dz^{k+1}}\frac{z}{\ln(1+z)}\right]_{z=0}\]- Parameters:
- k
int (starts from zero)
- k
- Returns:
sympy.core.numbers.Rationalkth Gregory coefficient
- pykbe.gregory.gregory_weights(k)[source]#
Gregory quadrature weights (double precision).
See Table 9 in [NESSI].
- pykbe.gregory.gregory_weights_exact(k)[source]#
Gregory quadrature weights (exact).
See Table 9 in [NESSI].
\[\begin{split}\mathbf{w} = \begin{bmatrix} 1 & 0 & 0 & 0 & \cdots \\ -1 & 1 & 0 & 0 & \cdots \\ 1 & -2 & 1 & 0 & \cdots \\ -1 & 3 & -3 & 1 & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \\ \end{bmatrix} \begin{bmatrix} G_0 \\ G_1 \\ G_2 \\ G_3 \\ \vdots \end{bmatrix} + \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \\ \vdots \end{bmatrix}\end{split}\]
- pykbe.gregory.integral_intermediate1(m, a, b)[source]#
Evaluates \(\int_0^m (m-x)^a x^b \, dx\).
- Parameters:
- Returns:
sympy.core.numbers.Rational\(\int_0^m (m-x)^a x^b \, dx\).
See also
integral_intermediate2Evaluates
integral_intermediate1for all a, b.
- pykbe.gregory.integral_intermediate2(m, k)[source]#
Evaluates \(\int_0^m (m-x)^a x^b \, dx\) for all a, b.
\[M^{(k)}_{m; a, b} = \int_0^m (m-x)^a x^b \, dx\]See also
integral_intermediate1to calculate a single element.
- pykbe.gregory.master_gregory_weights(k, n)[source]#
Quadrature weights.
Gives row n of the matrix in Eq. 98 from [NESSI].
- pykbe.gregory.poly_differentiation_weights(k)[source]#
Double precision polynomial differentiation weights.
Same as
poly_differentiation_weights_exactbut in double precision.
- pykbe.gregory.poly_differentiation_weights_exact(k)[source]#
Polynomial differentiation weights.
See equation 85 in [NESSI].
\[D^{(k)}_{ml} = \sum_{a=1}^k P^{(k)}_{al}a m^{a-1}.\]
- pykbe.gregory.poly_integration_weights(k)[source]#
Double precision polynomial integration weights.
Same as
poly_integration_weights_exactbut in double precision.
- pykbe.gregory.poly_integration_weights_exact(k)[source]#
Polynomial integration weights.
\[\begin{split}I^{(k)} = \begin{bmatrix} 0 & 0 & 0 & \cdots & 0 \\ \frac{1}{1} & \frac{1}{2} & \frac{1}{3} & \cdots & \frac{1}{k+1} \\ \frac{2^1}{1} & \frac{2^2}{2} & \frac{2^3}{3} & \cdots & \frac{2^{k+1}}{k+1} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ \frac{k^1}{1} & \frac{k^2}{2} & \frac{k^3}{3} & \cdots & \frac{k^{k+1}}{k+1} \\ \end{bmatrix} (V^{(k)})^{-1}\end{split}\]
- pykbe.gregory.poly_interpolation_weights(k)[source]#
Double precision polynomial interpolation weights.
Same as
poly_interpolation_weights_exactbut in double precision.
- pykbe.gregory.poly_interpolation_weights_exact(k)[source]#
Polynomial interpolation weights (exact).
\[P^{(k)} = (V^{(k)})^{-1}\]
- pykbe.gregory.sympy_inv_vandermonde(k)[source]#
Inverse of Vandermonde matrix.
- Parameters:
- k
int Polynomial degree.
- k
- Returns:
- vinv(k+1, k+1)
sympy.matrices.dense.DenseMatrix Inverse of Vandermonde matrix constructed from points 0, 1, …, n
- vinv(k+1, k+1)
- pykbe.gregory.sympy_vandermonde(k)[source]#
Vandermonde matrix.
\[\begin{split}V^{(k)} = \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \\ 1 & 1 & 1 & \cdots & 1 \\ 1 & 2^1 & 2^2 & \cdots & 2^n \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & k & k^2 & \cdots & k^k \\ \end{bmatrix}\end{split}\]- Parameters:
- k
int Polynomial degree.
- k
- Returns:
- v(k+1, k+1)
sympy.matrices.dense.DenseMatrix Vandermonde matrix constructed from points 0, 1, …, k
- v(k+1, k+1)