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

What should ApproxFun do with roots of periodic functions? #741

Closed
eprovst opened this issue Apr 29, 2021 · 3 comments · Fixed by JuliaApproximation/ApproxFunFourier.jl#40

Comments

@eprovst
Copy link

eprovst commented Apr 29, 2021

Currently if you search for the roots of a periodic function the result, whilst correct, are sometimes somewhat unexpected:

julia> c = Fun(cos, Fourier())
Fun(Fourier(【0.0,6.283185307179586❫),[-5.622629982202156e-17, 1.2537963267703604e-16, 1.0])

julia> roots(c)
2-element Vector{Float64}:
 -1.5707963267948966
  1.570796326794897

In this example one of the roots is outside of the interval [0, 2π) and one of the roots within that interval (namely 3π/2) isn't returned. In general I think it would be preferable if roots searches within the 'base' interval and not outside of it. Another option would be to give some sort of 'infinite' vector, but that might unnecessarily overcomplicate things.

@dlfivefifty
Copy link
Member

just a bug: roots is using -π..π as the "base interval". A PR fixing this would be appreciated.

@eprovst
Copy link
Author

eprovst commented Apr 29, 2021

The bug seems to reside in ApproxFunFourier.jl/src/roots.jl.

@dlfivefifty
Copy link
Member

It looks like tocanonical is broken:

julia> tocanonical(Circle(),-im)
-1.5707963267948966

In

https://github.com/JuliaApproximation/ApproxFunFourier.jl/blob/cd406eb7e001223d24865eefc75dc83344425c55/src/Domains/Circle.jl#L46

we probably want to add mod(..., 2convert(T,π))

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

Successfully merging a pull request may close this issue.

2 participants