Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basis function matrix and coefficient vector #20

Open
121180875 opened this issue Mar 13, 2024 · 4 comments
Open

basis function matrix and coefficient vector #20

121180875 opened this issue Mar 13, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@121180875
Copy link

If I want to extract the basis function matrix and coefficient vector after completing interpolation, what steps should I take?

@stevengj
Copy link
Member

By basis-function matrix I guess you mean the Chebyshev–Vandermonde matrix? We don't compute this matrix at all for interpolation (and instead use a much faster algorithm via FFTs). It is computed during regression, but is not saved. However, you can construct it by calling FastChebInterp.chebvandermonde (currently not documented, though).

Given a ChebPoly object c, the coefficients are c.coefs. Probably this should be documented too.

@stevengj stevengj added the documentation Improvements or additions to documentation label Jan 30, 2025
@dhjx1996
Copy link

Hi @stevengj, thank you for this great package! Following up on this issue, I have a 4D ChebPoly object, c, and I would like to get the power series coefficients, i.e. the coef argument for a 4-variable https://numpy.org/doc/2.1/reference/generated/numpy.polynomial.polynomial.Polynomial.html#numpy.polynomial.polynomial.Polynomial. I would appreciate some tips on how to do that (is the solution as simple as just flattening c.coefs?). Also, are c.coefs power series coefficients or Chebyshev series coefficients, i.e. for https://numpy.org/doc/stable/reference/generated/numpy.polynomial.chebyshev.Chebyshev.html#numpy.polynomial.chebyshev.Chebyshev)?

Thank you very much!

@stevengj
Copy link
Member

stevengj commented Mar 19, 2025

The whole point of using Chebyshev polynomials is that you don't want to compute the monomial coefficients — that basis is very badly behaved at high degrees.

The Chebyshev polynomial coefficients are stored in c.coefs.

@dhjx1996
Copy link

Hi @stevengj, I understand that. I wanted to perform the conversion for comparison not computation. This answers my question though, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants