# A problem occurs when extracting specific positions of a discrete Fourier transform [closed]

By the definition in Wolfram language, an expression Fourier[list,{p1,p2...}] will return specific positions (p1,p2...) of the discrete Fourier transform. It dos work in a simple example like Fourier[{1, 3, 5, 7, 9}, {{1, 2}}], whose result is

{11.1803 + 0. I, -2.23607 - 3.07768 I}


which is indeed the first two components of the DFT of the array {1,2,3,4,5}.

However, when I try to use some different convention of Fourier transform and I add set the FourierParameters like this

 Fourier[{1, 3, 5, 7, 9}, FourierParameters -> {0, 1/(2 \[Pi])}, {{1, 2}}]


It can not give me any result. And it says

Fourier::nonopt: Options expected (instead of {{1,2}}) beyond position 2 in Fourier[{1,3,5,7,9},FourierParameters->{0,1/(2 [Pi])},{{1,2}}]. An option must be a rule or a list of rules. >>

Does anyone know what happens here? I am really new to Mathematica so I cannot understand this wrong message.

(Background: I am doing Fourier analysis of a very complicated time-dependent function into the frequency domain and only certain frequency range is important to me so I want to extract it to reduce calculation burden. As we know, in physics, the Fourier transform between time domain and frequency domain does not contain the factor "2pi" in the exponential, which is different to the default definition in Wolfram language, so I have to set it manually using "FourierParameters". But it cannot yield the result here. My original function is very tedious so I just make a simple example here)

## closed as off-topic by m_goldberg, MarcoB, J. M. will be back soon♦Aug 13 '17 at 5:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, MarcoB, J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

• The option (FourierParameters) should come last. The syntax is Fourier[..., options]. – C. E. Aug 12 '17 at 21:39
• It does not work either if I put it at the last. It will give message like "Fourier::psl: Position specification {{2 ，^2 (FourierParameters->{0,1/(2 [Pi])})}} in Fourier[{1,3,5,7,9},{{2 ，^2 (FourierParameters->{0,1/2 Power[<<2>>]})}}] is not a machine-sized integer or a list of machine-sized integers. >>" – Fred Aug 12 '17 at 21:59
• Use this: Fourier[{1, 3, 5, 7, 9}, FourierParameters -> {0, 1/(2 \[Pi])}][[{1, 2}]] which is using the shortcut [[ ]] for Part. – bill s Aug 12 '17 at 22:00

You are missing a set of curly parenthesis:

Fourier[{1, 3, 5, 7, 9}, {{{1, 2}}}, FourierParameters -> {0, 1/(2 \[Pi])}]


or use the more straightforward:

Fourier[{1, 3, 5, 7, 9}, FourierParameters -> {0, 1/(2 \[Pi])}][[{1, 2}]]


which is using the shortcut [[ ]] for Part.

• OK, thank you very much – Fred Aug 12 '17 at 23:37
• "use the more straightforward" - the point of the second argument is that (allegedly) it takes less time and memory to compute just a few components of the transform than to return the whole transform just to get those same few, at the expense of (possibly) slightly less accuracy. – J. M. will be back soon Aug 13 '17 at 1:59