Hi Lubos, I don't know a whole lot about transforms however, I do remember one bit of information that may be useful to you: The prefactors in the sine transform (which is of course related to the fourier transform) are actually matters of convention. The sqrt(2/pi) is not always the prefactor! The prefactor is usually chosen to be sqrt(2/pi) so that the inverse transform will also have a prefactor of sqrt(2/pi) and there will be some symmetry in the two formulas so that they look alike and are easier to remember. However, SOMETIMES people chose the transform or inverse transform (I can't recall which) to have a 2/pi prefactor, and the other to have no prefactor. I comes down to a matter of convention and it doesn't matter which one you chose, as long as you are consistent. Please careful and make sure you a certain of the convention chosen and you a consistent in what you code and you will be fine. Hope this helps, Frank PS> Dear Everyone, I am trying to get my email mailing list style fixed so that I don't break mailing list etiquette. Please email me personal to check me if this email sucked. Sorry for my previous mistakes! -- Frank Lagor Ph.D. Candidate Mechanical Engineering and Applied Mechanics University of Pennsylvania
hi,
I don't know a whole lot about transforms however, I do remember one bit of information that may be useful to you: The prefactors in the sine transform (which is of course related to the fourier transform) are actually matters of convention. The sqrt(2/pi) is not always the prefactor! The prefactor is usually chosen to be sqrt(2/pi) so that the inverse transform will also have a prefactor of sqrt(2/pi) and there will be some symmetry in the two formulas so that they look alike and are easier to remember. However, SOMETIMES people chose the transform or inverse transform (I can't recall which) to have a 2/pi prefactor, and the other to have no prefactor. I comes down to a matter of convention and it doesn't matter which one you chose, as long as you are consistent. well, all this is clear to me.
if i do iDST(DST(f(r)) on discrete data, i get the original data back (expected result). this would indicate that 1) either the sqrt(2/pi) norm shouldn't be used for discrete data (why?) 2) the sqrt(2/pi) factor is taken care of somewhere inside the DST function (how?) this is the thing i'd really love to know - is the answer 1 or answer 2 correct? in my opinion, it shouldn't matter what combination of norms i use, as soon as they are consistent - but at the moment, i have the following problem. i need to iteratively solve H(r) = C(r) + C(r)*H(r) where the star denotes convolution and H and C are functions of interest. the easiest way to solve this should be fourier transforming this, solving H(k) = C(k) + C(k)H(k) by H(k) = C(k)/(1-C(k)) and then transforming H(k) back for further processing. in practice, i calculate C, transorm it into fourier space, solve for H and transform it back, where it serves as a 'parameter' for new C. due to the nature of my functions, the 3D-FT can be replaced by 1D fourier-bessel transformation AND some constants. depending on how one distributes the normalization of FT, one arrives at, e.g., FB(f(r)) = f(k) = 4pi/k int_0^infty f(r) r sin(kr) dr iFB(f(k)) = f(r) = 1/2rpi^2 int_0^infty f(k) k sin(kr) dk this can be calculated using fourier-sine transform of a new function F(r)=f(r)*r and F(k)=f(k)*k, respectively FB(f(r)) = 4pi/k sqrt(pi/2) int_0^infty F(r) sin(kr) dr iFB(f(r)) = 1/2rpi^2 sqrt(pi/2) int_0^infty F(k) sin(kr) dk so one would expect that the story is clear - do fourier-sinus, multiply with the respective normalization constant... but the problem is, that this doesn't work. at this point i asked the question - *should* i actually use these factors (coming from continuous transforms) also in the case of discrete transforms, which are self normalized to a number of discretization points?
PS> Dear Everyone, I am trying to get my email mailing list style fixed so that I don't break mailing list etiquette. Please email me personal to check me if this email sucked. Sorry for my previous mistakes! just a comment - don't change the subject line, since it breaks the thread
best, -- Lubos _@_" http://www.lubos.vrbka.net
Ludos, First let me clarify: the factor in front of the continuous forms is 1/sqrt(2pi), not sqrt(2/pi) like I said previously (I was confused).
if i do iDST(DST(f(r)) on discrete data, i get the original data back (expected result). this would indicate that 1) either the sqrt(2/pi) norm shouldn't be used for discrete data (why?)
I don't think the factors should be added on at all. The mere transform and invtransform functions should handle all factors. This is related to what I want to type later on.
2) the sqrt(2/pi) factor is taken care of somewhere inside the DST function (how?)
Yes. It should be. Like I said before, the convention chosen doesn't really matter as long as the you do the FT and then the IFT, because the factors from the two operations must multiple together to give 1/(2pi) in the end (this is built into the answer. The problem with convention only comes when you want to compare numbers of transformed data (still in fourier space) with someone else. Then you need to know if your conventions are the same.
this is the thing i'd really love to know - is the answer 1 or answer 2 correct?
I think the actual answer lies in the fact that the fourier transform is actually derived from the fourier series. The fourier series is a sum of some coefficients times an exponential. There is an equation for calculating these coefficients and it is something like 1/(2pi) times an integral, and thats where the 1/(2pi) comes in (actually it comes in when the formula for the coefficients is derived). See the book Functions of a complex variable by Carrier, Krook, and Pearson for the details of this derivation. I think that if you see this, all your concerns about the factors will be taken care of. -Frank -- Frank Lagor Ph.D. Candidate Mechanical Engineering and Applied Mechanics University of Pennsylvania
I do not know about cosine transform much as I do not use it, but the coefficient 1/(2pi) in the continuous time Fourier transform is not something that is quite randomly selected (even though, I admit, in calculating discrete FT you have more freedom at choosing the scaling factor, and sometimes for reasons of symmetry there is a 1/sqrt(N) scaling factor in both directions). Using latex, you either have completely symmetric expressions if one uses 'f' frequency: X(f) = \int_{-\infty}^{\infty} x(t)\ e^{- i 2\pi f t}\,dt, x(t) = \int_{-\infty}^{\infty} X(f)\ e^{i 2 \pi f t}\,df, or if you use angular frequency ω=2 pi f, than you have: X( ω) = \int _{-\infty}^\infty x(t)\ e^{- i ω t}\,dt x(t) = \frac{1}{2\pi} \int _{-\infty}^{\infty} X( ω)\ e^{ i ω t}\,d ω, Not that this will be of much help to Lubos. Lubos, you may want to look at the following Wiki page, or if you are still not happy, I will dig up my literature and find out more about DCT. You are probably interested in DCT II type from this article: http://en.wikipedia.org/wiki/Discrete_cosine_transform and you might want to look also at: http://en.wikipedia.org/wiki/Discrete_Fourier_transform Ivo 2008/7/26 Frank Lagor <dfranci@seas.upenn.edu>:
Ludos,
First let me clarify: the factor in front of the continuous forms is 1/sqrt(2pi), not sqrt(2/pi) like I said previously (I was confused).
if i do iDST(DST(f(r)) on discrete data, i get the original data back (expected result). this would indicate that 1) either the sqrt(2/pi) norm shouldn't be used for discrete data (why?)
I don't think the factors should be added on at all. The mere transform and invtransform functions should handle all factors. This is related to what I want to type later on.
2) the sqrt(2/pi) factor is taken care of somewhere inside the DST function (how?)
Yes. It should be. Like I said before, the convention chosen doesn't really matter as long as the you do the FT and then the IFT, because the factors from the two operations must multiple together to give 1/(2pi) in the end (this is built into the answer. The problem with convention only comes when you want to compare numbers of transformed data (still in fourier space) with someone else. Then you need to know if your conventions are the same.
this is the thing i'd really love to know - is the answer 1 or answer 2 correct?
I think the actual answer lies in the fact that the fourier transform is actually derived from the fourier series. The fourier series is a sum of some coefficients times an exponential. There is an equation for calculating these coefficients and it is something like 1/(2pi) times an integral, and thats where the 1/(2pi) comes in (actually it comes in when the formula for the coefficients is derived). See the book Functions of a complex variable by Carrier, Krook, and Pearson for the details of this derivation. I think that if you see this, all your concerns about the factors will be taken care of.
-Frank
-- Frank Lagor Ph.D. Candidate Mechanical Engineering and Applied Mechanics University of Pennsylvania
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
hi guys, it seems that the problems i had with the prefactors involved in the sine transformation were more or less caused by my ignorance and a lack of knowledge (as usually) :) just in case somebody would stumble upon this issue in the future, i will summarize my 'findings'. the function for forward/inverse discrete sine transformation are themselves normalized to the number of sampling points. therefore, F' = DST(f) iDST(F') = f however, to get the real sine transformation of f, it's necessary to multiply the abovementioned expression with the step size in the real space F = DST(f) dr this expression leads to the equivalent of the sine transformation, where the 2/pi normalization is carried out in the inverse transformation. for the equivalent of the unitary sine transform, it's needed to further multiply with sqrt(2/pi) the same then applies for the inverse transformation, so in the end x = 2/pi dr dk iDST(DST(f)) but the dr dk product brings in the number of sampling points. for the sine transformation, dk = pi/(Ndr) and, therefore, x = 2/pi pi/N iDST(DST(f)) = 2/N f in order to get the function f back, it's necessary to multiply the inverse FT with N/2. this essentially solves the question posted in sine transformation weirdness 'thread' as well. -- Lubos _@_" http://www.lubos.vrbka.net
participants (3)
-
Frank Lagor
-
Ivo Maljevic
-
Lubos Vrbka