Fix Trefethen(Strip)General#305
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for forwarding extra keyword arguments to the inner quadrature constructor inside TrefethenGeneral and TrefethenStripGeneral, so quadratures with additional parameters (e.g. TanhSinh's delta) can be used.
Changes:
- Added
**quadrature_paramstoTrefethenGeneral.__init__and forwarded them to the innerquadrature(npoints, ...)call. - Added the same
**quadrature_paramspass-through toTrefethenStripGeneral.__init__. - Added a unit test verifying
TrefethenGeneralaccepts and uses extra quadrature params viaTanhSinh.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/grid/onedgrid.py | Adds **quadrature_params to TrefethenGeneral and TrefethenStripGeneral, forwarding to the inner quadrature; updates TrefethenGeneral docstring. |
| src/grid/tests/test_onedgrid.py | Adds a regression test exercising TrefethenGeneral with an extra delta parameter for TanhSinh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name = "Trefethen-Strip-General" | ||
|
|
||
| def __init__(self, npoints: int, quadrature, rho: float = 1.1): | ||
| def __init__(self, npoints: int, quadrature, rho: float = 1.1, **quadrature_params): |
|
@merreeves and @PaulWAyers, in my opinion, the way that |
|
I don't think there is any reason not to treat (both of) the Trefethen tricks as a transformation. As I recall, the mathematical argument is pretty tightly tied to Chebychev/Fejer/Clenshaw-Curtis quadrature, but there is no real reason to not generalize. |
TrefethenGeneral and TrefethenStripGeneral OneDGrids can take any OneD Quadrature and transform it. Some OneDGrids have extra parameters which the Trefethen transforms don't account for (e.g. TanhSinh has an additional parameter delta: float = 0.1). The added code corrects this and have tested it.