Skip to content

at-points: change at-points operators to use Chebyshev polynomials of the first kind (normalized)#1963

Open
zatkins-dev wants to merge 2 commits intomainfrom
zach/at-points-cheby-first-kind
Open

at-points: change at-points operators to use Chebyshev polynomials of the first kind (normalized)#1963
zatkins-dev wants to merge 2 commits intomainfrom
zach/at-points-cheby-first-kind

Conversation

@zatkins-dev
Copy link
Copy Markdown
Collaborator

Purpose:

We're currently using Chebyshev polynomials of the second kind, which don't have their range bounded to the same [-1,1] as their domain. I'm really not sure why we would be using the second kind, since they're numerically less stable and have a more complicated derivative.

This doesn't cause any issues with tests here or in Ratel.

LLM/GenAI Disclosure:

None

@zatkins-dev
Copy link
Copy Markdown
Collaborator Author

we could possibly squeeze an extra register out of the cuda and hip impls, since they use 3 doubles for the derivative calculation right now and we should only need two with this change.

Comment thread interface/ceed-basis.c
static int CeedChebyshevPolynomialsAtPoint(CeedScalar x, CeedInt n, CeedScalar *chebyshev_x) {
chebyshev_x[0] = 1.0;
chebyshev_x[1] = 2 * x;
chebyshev_x[1] = x;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you toss references to Chebyshev of the first kind for the future grad student trying to grok what we're doing here? (Also for the derivative function)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah for sure, though tbh the options are wikipedia or a book (or both)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, Wikipedia is probably good for a quick reference to get people oriented, and I like the refs being here in this file. That makes the most sense I think


chebyshev_x[1] = 1.0;
chebyshev_x[2] = 2 * x;
chebyshev_x[0] = 1.0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically we should note here that the second kind is used to make the derivatives of the first kind (probably why I stuck with the second kind throughout? I don't recall)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I know you have it there mathematically, but I'm trying to picture the theoretical new grad student)

Comment thread interface/ceed-basis.c
@@ -47,7 +47,7 @@ const CeedBasis CEED_BASIS_NONE = &ceed_basis_none;
**/
static int CeedChebyshevPolynomialsAtPoint(CeedScalar x, CeedInt n, CeedScalar *chebyshev_x) {
chebyshev_x[0] = 1.0;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
chebyshev_x[0] = 1.0;
// Chebyshev polynomials of the first kind, 3 term recurrence: T_0(x) = 1, T_1(x) = x, T_n = 2 x T_{n-1} - T_{n-2}
// For more info, see e.g. https://en.wikipedia.org/wiki/Chebyshev_polynomials#Recurrence_definition
chebyshev_x[0] = 1.0;

Comment thread interface/ceed-basis.c
Comment on lines 69 to 70
chebyshev_x[1] = 1.0;
chebyshev_x[2] = 2 * x;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
chebyshev_x[1] = 1.0;
chebyshev_x[2] = 2 * x;
// Note, these are Chebyshev polynomials of the 2nd kind, used for derivatives
// See e.g. https://en.wikipedia.org/wiki/Chebyshev_polynomials#Differentiation_and_integration for the recurrence
chebyshev_x[1] = 1.0;
chebyshev_x[2] = 2 * x;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants