Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH: Extended chebinterpolate to interpolate a multidimensional function #20529

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

pbrod
Copy link
Contributor

@pbrod pbrod commented Dec 7, 2021

Currently there are no functions in chebyshev.py that do N-dimensional fitting for N>1
This submission is a attempt to fill the above mentioned gap and complements the efforts in #14151.

The multidimensional interpolation method implemented here uses the 1D Discrete Cosine Transform (DCT) instead of the vandermonde method. This is a reimplementation of the chebfitfunc function found in #6071. The accuracy of the new interpolation method is better than the old chebinterpolate function especially for polynomials of high degrees as shown
in the figures below.

The figures show the interpolation error for various degrees when interpolating the exponential function from -1 to 1 using DCT (blue) compared to the Vandermonde method (orange) used in the previous version of chebinterpolate.
Most notable the accuracy of the Vandermonde method deteriorates as the degree increaces beyond the value of 32 while DCT keeps machine precision accuracy in this case (i.e. error less than 3,0e-16). The run times for each method is given in the legend and show that the Vandermonde method is slightly faster for degrees less or equal to 63 while DCT is slightly faster otherwise.

Figure_256
Figure_128
Figure_64
Figure_32
Figure_16

Also added domain as input to chebinterpolate in order to interpolate the function over any input domain.

Also replaced all references to the missing chebfromfunction with chebinterpolate.

@pbrod pbrod changed the title ENH: Extended chebinterpolate with the possibility to interpolate a multidimensional function ENH: Extended chebinterpolate to interpolate a multidimensional function Dec 7, 2021
@pbrod pbrod force-pushed the enh_chebinterpolate branch 2 times, most recently from 2953284 to 5fd0d82 Compare December 7, 2021 11:17
@pbrod pbrod force-pushed the enh_chebinterpolate branch 2 times, most recently from cb5261f to 4a2f6ea Compare February 14, 2022 14:52
Currently there are no functions in chebyshev.py that do N-dimensional fitting for N>1
This submission is a attempt to fill the above mentioned gap and complements the efforts in numpy#14151.

The multidimensional interpolation method implemented here uses the 1D Discrete Cosine Transform (DCT) instead of the vandermonde method. This is a reimplementation of the chebfitfunc function found in numpy#6071. The accuracy of the new interpolation method is better than the old one especially for polynomials of high degrees.

Also added domain as input to chebinterpolate in order to interpolate the function over any input domain.
Added test_2d_approximation for testing interpolation of a 2D function.
Replaced all references to the missing chebfromfunction with chebinterpolate.
Made doctest of chebinterpolate more robust.
@pbrod pbrod force-pushed the enh_chebinterpolate branch from 4a2f6ea to 1b9e8d3 Compare February 14, 2022 15:13
@pbrod pbrod requested a review from tylerjereddy February 14, 2022 16:06
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.