Closed erny123 closed 9 months ago
It's because you're using your own second-kind Chebyshev points as opposed to chebyshevpoints(Float64, nn, Val(2))
, which are decreasing. Once I change that in your second code block, the output is correct.
@MikaelSlevinsky you're right! Thanks for the help!
Posted on the Julia discord: https://discourse.julialang.org/t/error-in-fasttransforms-jl-for-cheb2leg/108995
I’m working with Legendre transforms and according to FastTransforms.jl, one can do a Chebyshev Transform and use the cheb2leg() function to transform from Chebyshev coefficients to Legendre coefficients.
I’ve compared this method to the pure naive transform given by wikipedia and it seems like every odd coefficient comes out to be the negative of what an actual Legendre transform should give.
I am using the Gauss-Lobatto points. The functions below calculate the Gauss-Lobatto points and weights for the Legendre and Chebyshev functions.
Below, here I try to do a legendre transform of a function with the second, third, fourth, and fifth Legendre polynomials:
The results are the following:
You can see that the odd polynomial coefficients (n=odd) are the negative of the actual legendre coefficient.
Anyone have an idea if this is actually what’s happening?