f*******d 发帖数: 339 | 1 I need to calculate at points r1, r2, ... r_max the function f(r)
given
by
f(r)= \int_0^\infty g(k) sinc(kr) dk, where sinc(x)=sin(x)/x, g(k)
is a tabulated function. Now I can certainly do the integral one by
one, but hoping to use FFT to improve efficience, I observed that this
can be rewritten as
f(r)=1/r \int_0^\infty g(k)/k dk, which is just the sine
transformation.
So, I used the program sinft given in numerical recipes to
do the calculation. However, it seems that the result is very
bad a | f*******d 发帖数: 339 | 2
it was a typo, should be
f(r)=1/r \int_0^\infty g(k)/k sin(kr) dk | B***y 发帖数: 83 | 3
I am not sure about what problem might occur in the numeric
integration. Just
some suggestions:
1) when r is quite large, sin(kr) is oscillating quite fast, thus
usually you
need to take smaller time-steps to take care of it.
2) since you choose g(k) =1, then \int_0^\infty 1/k sin(kr) dk is not
absolutely
integrable, thus there might be some problem when k is small, where
1/k is quite
large, causing some numeric problem.
good luck.
【在 f*******d 的大作中提到】 : : it was a typo, should be : f(r)=1/r \int_0^\infty g(k)/k sin(kr) dk
|
|