diff --git a/doc/quadrature.rst b/doc/quadrature.rst index 95d406c878ab4b6431bcbeca90fbf345cefa1987..4200ff0d289d369c715700f7fc7e3aa323827b68 100644 --- a/doc/quadrature.rst +++ b/doc/quadrature.rst @@ -25,6 +25,10 @@ Jacobi-Gauss quadrature in one dimension .. autoclass:: LegendreGaussQuadrature +.. autoclass:: ChebyshevGaussQuadrature + +.. autoclass:: GaussGegenbauerQuadrature + .. currentmodule:: modepy.quadrature.jacobi_gauss .. autofunction:: jacobi_gauss_lobatto_nodes diff --git a/modepy/__init__.py b/modepy/__init__.py index 72ee4090515f5d39d4e1242b7782b8e84c55c250..02c72984288863a9337074634f3747fa63a72903 100644 --- a/modepy/__init__.py +++ b/modepy/__init__.py @@ -35,13 +35,16 @@ from modepy.matrices import (vandermonde, modal_face_mass_matrix, nodal_face_mass_matrix) from modepy.quadrature import Quadrature, QuadratureRuleUnavailable from modepy.quadrature.jacobi_gauss import ( - JacobiGaussQuadrature, LegendreGaussQuadrature) + JacobiGaussQuadrature, LegendreGaussQuadrature, ChebyshevGaussQuadrature, + GaussGegenbauerQuadrature) from modepy.quadrature.xiao_gimbutas import XiaoGimbutasSimplexQuadrature from modepy.quadrature.vioreanu_rokhlin import VioreanuRokhlinSimplexQuadrature from modepy.quadrature.grundmann_moeller import GrundmannMoellerSimplexQuadrature from modepy.version import VERSION_TEXT as __version__ # noqa: N811 +GaussLegendreQuadrature = LegendreGaussQuadrature + __all__ = [ "__version__", @@ -59,6 +62,7 @@ __all__ = [ "Quadrature", "QuadratureRuleUnavailable", "JacobiGaussQuadrature", "LegendreGaussQuadrature", + "GaussLegendreQuadrature", "ChebyshevGaussQuadrature", "XiaoGimbutasSimplexQuadrature", "GrundmannMoellerSimplexQuadrature", "VioreanuRokhlinSimplexQuadrature", ] diff --git a/modepy/quadrature/jacobi_gauss.py b/modepy/quadrature/jacobi_gauss.py index ab268e14a826818d40b9b56e0c1e5aef1a78885a..4e7ac833e890a2d6a870e762f9c3cea263d0df50 100644 --- a/modepy/quadrature/jacobi_gauss.py +++ b/modepy/quadrature/jacobi_gauss.py @@ -126,12 +126,41 @@ class LegendreGaussQuadrature(JacobiGaussQuadrature): Inherits from :class:`modepy.Quadrature`. See there for the interface to obtain nodes and weights. + + (NOTE: Gauss–Legendre quadrature is a special case of Gauss–Jacobi + quadrature with α = β = 0.) """ def __init__(self, N): # noqa JacobiGaussQuadrature.__init__(self, 0, 0, N) +class ChebyshevGaussQuadrature(JacobiGaussQuadrature): + """Chebyshev-Gauss quadrature of the first/second kind are special cases + of Gauss–Jacobi quadrature with α = β = -0.5/0.5. + + .. versionadded:: 2019.1 + """ + + def __init__(self, N, kind=1): # noqa + if kind == 1: + # FIXME: division by zero + JacobiGaussQuadrature.__init__(self, -0.5, -0.5, N) + elif kind == 2: + JacobiGaussQuadrature.__init__(self, 0.5, 0.5, N) + + +class GaussGegenbauerQuadrature(JacobiGaussQuadrature): + """Gauss-Gegenbauer quadrature is a special case of Gauss–Jacobi quadrature + with α = β. + + .. versionadded:: 2019.1 + """ + + def __init__(self, alpha, N): # noqa + JacobiGaussQuadrature.__init__(self, alpha, alpha, N) + + def jacobi_gauss_lobatto_nodes(alpha, beta, N): # noqa """Compute the Gauss-Lobatto quadrature nodes corresponding to the :class:`JacobiGaussQuadrature`