I don't understand the equation37 in simulate ocean water by Jerry Tessendorf.The result is all complex number, how to be the slope.Even if I compute the magnitude of it,the result is just positive which is obvious wrong.As There must be some points whose slope is negative.Who can help me.Thank you.
Complex results in inverse Fourier transform for simulating ocean water
2
$\begingroup$
pde
fourier-analysis
mathematical-modeling
fluid-dynamics
-
0Equation 37 is inverse fourier transform and ik*h~(k,t) does not preserve the complex conjugation property.So the result of the inverse fourier transform is a complex.Am I wrong? – 2012-11-28
-
1Check the magnitude of the imaginary parts of the inverse Fourier transform that you computed. If these are very small (order of machine error), they come from roundoff and can be ignored. That is, just proceed with the real parts. – 2012-11-28
-
0Do you mean that they should be small?But I found that they are not small enough compare to the real part. – 2012-11-28
1 Answers
1
If $h(x)$ is a real valued function we have that since $h(x) = \bar{h}(x)$ that its Fourier series
$$ h(x) \approx \sum \tilde{h}(k) \exp ikx = \sum \bar{\tilde{h}}(k) \exp -ikx \approx \bar{h}(x)$$
So $\tilde{h}(k) = \bar{\tilde{h}}(-k)$. This is a fundamental property of the Fourier transform of real valued functions.
Now if we write
$$ \nabla h(x) \approx \sum i k \tilde{h}(k) \exp ikx = \sum \eta(k) \exp ikx $$
we note that
$$ \bar\eta(k) = \eta(-k) $$
by a direct computation. And hence
$$ \nabla h(x) = \overline{\nabla h}(x) $$
is a real valued function.
-
0If you are doing this numerically and you find that the imaginary component of the Fourier series is large, that means you are either making a mistake or you are running into problems with discretisations (too much error). If you are worried about imaginary numbers, you can just take the real-valued representation $$ h(x) \approx \sum h_c(k) \cos kx + h_s(k) \sin kx $$ using the Fourier sine and cosine series. You will have that the derivative is $$ \nabla h(x) \approx \sum k h_s(k) \cos kx - k h_c(k) \sin kx $$ which is manifestly real-valued. – 2012-11-28
-
0From your equation is very clear and right.But I still have one question.The K is a vector, so equation 37 should be computed twice:kx and ky.K = (kx, ky).Then i*kx*h~(k) does not preserve the conjugation preperty. – 2012-11-28
-
0$k$ is a real-valued vector, so $\bar{ik} = -ik$. Hence $\overline{ik h(k,t)} = -i k \overline{h(k,t)} = -ik h(-k,t) = i(-k) h(-k,t)$ with no problem. – 2012-11-28
-
0In other words, what I wrote above carries through exactly in the case $x\in\mathbb{R}^n$ or $x\in \mathbb{T}^n$, if $kx$ is interpreted to mean the dot product and $\nabla$ is the gradient operator. Both sides of the equation for $\nabla h$ becomes now vector valued. – 2012-11-28
-
0We get a slope vector by computing the equation 37.So I compute the inverse fourier transform twice,first I substitute the iK(just the first one) with i*kx, second with i*kz.The result is the component of the slope vector.Am I wrong? – 2012-11-28
-
0Huh? "Compute the inverse Fourier transform twice"? Why? Why not just work with vector valued functions? But in any case, we have $\partial_{x_1} h(x) \approx \sum_{k_1,k_2} i k_1 \tilde{h}(k_1,k_2) \exp i (k_1 x_1 + k_2 x_2)$, so again the required properties hold. Without knowing how you "compute the inverse Fourier transform twice" I don't know what you did wrong. – 2012-11-28
-
0∂x1h(x)≈∑k1,k2ik1h~(k1,k2)expi(k1x1+k2x2)?I think the result is not a real number. – 2012-11-28
-
0Sorry.From the equation, the result should be real number.But in my program it's complex.You are so patient and professional.Thank you very much. – 2012-11-28
-
0Then your program is wrong. See my first comment. For help figuring out why your program is having too much errors, I recommend you ask over at our sister site on Scientific Computations, http://scicomp.stackexchange.com/ – 2012-11-28
-
0You are right.Thanks a lot again. – 2012-11-28
-
0I still have one more question.The result of equation 36 can be positive and negative.And if I don't get the absolution of it,the ocean surface tend to be very regular.But according to the paper,the author never get the absolution of the result of the equation 36. – 2012-11-29
-
0@user1859053 : I don't understand your question. What is "absolution?" Why would one need to "get the absolution of the result?" Is it directly related to the original question you asked here? If not maybe you can consider asking a new question (instead of in the comments here) so you can have more space to elaborate on what the problem is. – 2012-11-29
-
0I have asked a new question.The "absolution" means the absolute value.My english is just so so.Thank you.Oh, I have solved the problem.The FFTW computes the IDFT from x=(0,0),but I need compute it from x=(-Lx/2,-Lz/2). – 2012-11-30
-
0My question is this:If h(k) preserves complex conjugation property(in other words,h*(k) = h(-k),k can be just -n,-n+1,...0,1,...n-1),then i*k*h(k) also preserves complex conjugation property which is easy to derive.But actually i*k*h(k) do not preserve the complex conjugation property.Because we know h(-n) must be real value for h(k) is conjugation.Then i*k*h(-n) must be image value which destroy the complex conjugation property.How to explain this? – 2012-12-03
-
0Why is $h(-n)$ real valued? We just have that $h(-n) = h^*(n)$, no? Are you doing some sort of truncation in frequency? In that case you _will_ pick up error terms. In that case you should either cut off symmetrically (so $-n \leq k \leq n$) or use the $\cos$ and $\sin$ series instead as I indicated in my first comment. – 2012-12-03
-
0h(-n) must be real value.Because h(n) is periodic(Sorry I forget to point out that).h(n) is a DFT conjugate symmetric sequence.So h(-n) and h(0) must be real value. – 2012-12-04
-
0So h(-n) and h(0) must be real value.Not just h(-n) = h*(n).According to the paper,the frequency range is from -n to n-1.The number of component is 2n.What do you mean"cut off symmetrically"?If so,the num of component is 2n+1.Do you mean that I should do IDFT in odd number points? – 2012-12-04
-
0If you have $n$ data points, your DFT should give you the $n$ coefficients $h(0), \ldots, h(n-1)$. This sequence satisfies $\overline{h(k)} = h(n-k)$, and so can be extended periodically to all $\mathbb{Z}$ with $h(k) = h(k + \ell n)$ for every $\ell \in \mathbb{Z}$. Your problem, however, is that the finite/discrete difference operator is _not_ the same as the continuous derivative operator. As a _function_ the function recovered from the DFT is _not_ guaranteed to be real valued. It is only guaranteed to be real valued _on_ the sampling points. – 2012-12-04
-
0(In act, the DFT representation is also [not unique](http://en.wikipedia.org/wiki/Aliasing): you can change it by adding to it any periodic function that takes zero value on the sampling points...) In any case, I am neither willing nor capable of giving you a course on the _discrete_ Fourier transform. If you are studying a paper there's probably someone more qualified right around you to give you the foundations. – 2012-12-04
-
0If n is a even number,then h*(k) = h(n-k).If n is a odd number,then h*(k) = h(n-1-k).These can guarantee that the result of the IDFT is real number.I don't quite understand what you're saying,but thx. – 2012-12-05