Unwanted sine modes appearing in convolution using FFT
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy Julia MWE trong issue, tập trung vào việc xây dựng tần số fft, tính toán weight_hat và kết quả real(ifft(I_hat)). So sánh phép tích chập FFT với tích phân được tính thủ công và xác định liệu các dao động còn lại xuất phát từ thiết lập phép tích chập hay từ FastTransforms.jl; ghi lại nguyên nhân cùng với một cách sửa hoặc giới hạn có thể tái hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi All, I don't know if this is an issue with FastTransforms.jl specifically or something that I've done, but any guidance that could be provide will be appreciated.
To give a little bit of background, I'm trying to perform the following convolution (nV, r and r' are vectors):
n_\mathbf{V}(r) = \int d\mathbf{r}' \rho (r') \delta(|r-r'|-R) \frac{r-r'}{|r-r'|}
Where rho(r) is a profile which looks like (I've made sure it's periodic):
I have obtained an analytical expression for the fourier transform of the last two terms in the integral as:
\hat{w} = 4\pi i \frac{k}{|k|^3} (\sin(|k|R)-|k|R\cos(|k|R))
If I use just regular Float64, the resulting nV profile looks fine:
Except when I zoom in:
While these values are small, in a later part of my code, I need to divide this profile by a small number which makes this 'noise' blow up and affects calculations downstream.
I tried using FastTransforms.jl since it would let me go to higher precision. However, even when I use BigFloat, although it removes the noise, some unphysical oscillations remain:
Im no longer certain that these remaining oscillations are due to floating point errors. I also call these oscillations unphysical as, aside from the nature of this convolution integral, if I perform this convolution integral manually, the oscillations disappear completely (and I'm able to obtain the integral to higher precision).
Am I doing something wrong in the way I'm performing the convolution integral? Thanks!
I've attached an MWE below:
using FFTW, FastTransforms
# Generating the density profile
tanh_prof(x,start,stop,shift,coef) = 1/2*(start-stop)*tanh((x-shift)*coef)+1/2*(start+stop)
ub = 10
lb = -10
z = LinRange(lb,ub,4000)
rho1 = 1e3
rho2 = 1e-12
rho = @. tanh_prof(z,rho1,rho2,(ub/4+3*lb/4),20)*(z<=0) +
tanh_prof(z,rho2,rho1,(3*ub/4+lb/4),20)*(z>0)
# Obtaining the fourier transform of w_hat
freq = fftfreq(4000,4000/20)
R = 1/2*2pi
weight_hat = @. 0.0 - 4π*im*freq/abs(freq)^3*(sin(abs(freq)*R)-R*abs(freq)*cos(abs(freq)*R)) *(freq != 0.0)
# Performing the convolution integral
rho_hat = fft(rho)
I_hat = @. rho_hat*weight_hat
nV = real(ifft(I_hat))
- Ngôn ngữ chính
- Julia
- Star
- 282
- Fork
- 27
- Merge trung bình
- 9 giờ 21 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JuliaApproximation/FastTransforms.jl
-
Loading FastTransforms.jl can make FFTs via FFTW.jl 100x slower due to threading conflictsCó thể đã có người làm @dlfivefifty đã nhận 100 ngày trước. Đang mở
JuliaApproximation/FastTransforms.jl#267 · 2 reaction · 2 người được giao ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
JuliaApproximation/FastTransforms.jl#266 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
JuliaApproximation/FastTransforms.jl#263 · 2 bình luận ·
-
Allocating lmul!Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
JuliaApproximation/FastTransforms.jl#253 · 7 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Tất cả issue của JuliaApproximation/FastTransforms.jl
Issue tương tự
-
R_to_gamma and R_to_v are wrong for |Z| != 1 (e.g. heavy ions)Có thể đã có người làm @DavidSagan đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
bmad-sim/BeamTracking.jl#366 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TSDAE's docstring implies a theta argument it does not takeCó thể đã có người làm @singhharsh1708 đã nhận hôm nay. Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
SciML/PETScDiffEq.jl#282 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add more snippets to R and JuliaĐang mởenhancement good first issue help wanted
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 82/100
-
SavedSubsystem with an integer save_idxs maps the index the wrong way roundCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SciML/SciMLBase.jl#1643 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
authority-vechtstromen ready-for-agent
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Deltares/Ribasim-NL#890 ·
Maintainer thường phản hồi trong vòng 1 ngày