JuliaApproximation / JuliaApproximation/ApproxFun.jl
Integration of a function in default and Fourier spaces give incorrect results
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 559
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Integration in the default (Chebyshev between [-1,1], maybe?) and Fourier spaces gives incorrect results in the following code. Using Chebyshev with explicit bounds gives the correct result.
Sθ=PeriodicSegment(-π,π);
fn = Fun(θ -> sin(θ), Sθ);
D2 = Derivative(Sθ, 2);
L = -D2-10fn;
λ, v = ApproxFun.eigs(L, 500, tolerance=1E-10);
integrand = Fun(θ -> sin(θ)*v[1](θ)*v[2]'(θ) ); # seems to be Chebyshev, but somehow give incorrect result
integrand_fourier = Fun(θ -> sin(θ)*v[1](θ)*v[2]'(θ), Fourier(-π..π)); # incorrect
integrand_chebyshev = Fun(θ -> sin(θ)*v[1](θ)*v[2]'(θ), Chebyshev(-π..π)); # correct
println(integrate(integrand)(π)-integrate(integrand)(-π));
println(integrate(integrand_fourier)(π)-integrate(integrand_fourier)(-π));
println(integrate(integrand_chebyshev)(π)-integrate(integrand_chebyshev)(-π));
This outputs
0.0
0.0
2.42716878621213
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Julia reproducer in the issue and compare the three integration calls for the default, Fourier(-π..π), and Chebyshev(-π..π) spaces. Trace the integration behavior for the default and Fourier spaces; done means their results agree with the explicitly bounded Chebyshev result instead of returning 0.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100