# Tag Info

Accepted

### Computing numeric derivative via FFT - SciPy

FFT returns a complex array that has the same dimensions as the input array. The output array is ordered as follows: Element 0 contains the zero frequency component, F0. The array element F1 ...
• 2,525

### Why not use the convolution theorem for explicit timestepping?

This is a linear PDE, and so while this technique works here, it would not work for any nonlinear PDE. Often times when people are solving these equations it is to get experience with common solution ...
• 2,089
Accepted

### compute accurate derivatives using FFT

There is little you can do about it beyond just using more terms in the Fourier expansion. What you observe is called Gibbs phenomenon. It, in essence, says that if you have a function that is ...
• 55.5k

### Computing numeric derivative via FFT - SciPy

Maxim Umansky’s answer describes the storage convention of the FFT frequency components in detail, but doesn’t necessarily explain why the original code didn’t work. There are three main problems in ...
• 191
Accepted

### Numerically computing the advection equation

I see several issues: The DFT computed with fft puts the zero mode at the beginning of the array, and if you want to compute the derivative, it is necessary to ...
• 11.4k

### DFT of $g(\omega) \exp(i C \omega^2)$. How to do it ,if uniform sampling requires too much memory?

Expanding upon my comment above, if you only need a few digits of accuracy you can probably use the method of stationary phase. We can follow the procedure on Wikipedia. We can write the transform as ...
• 663

### Numpy FFT gives me a pulse shorter than it should be. Not sure what I am doing wrong

Running your code, it seems like your pulse looks kinda like this: (sorry for not adding units to the plots, I used the same as you, i.e. t is in fs and w in rad/fs) So, the FWHM is not correct (...
• 256

### Fourier transform by FFT : by using cubic splines to interpolate between data points, do we change the frequency content of the Fourier transform?

The frequency content of the interpolated signal is significantly influenced by the interpolation basis. If you have a band-limited function that you have adequately sampled (i.e. satisfying Nyquist ...

### Fourier transform by FFT : by using cubic splines to interpolate between data points, do we change the frequency content of the Fourier transform?

The interpolation indeed affects the Fourier transform. @Steve already gives the correct answer in general, but I want to give you an example that helps the intuition more. Think for example that you ...
• 55.5k
Accepted

### How do I avoid divide-by-zero when solving the Poisson equation with Fourier transforms?

You are solving Poisson's equation: $$\nabla^2 \Phi = 4\pi G \rho.$$ Notice that if $\Phi$ is a solution, then so is $\Phi+C$ for any constant $C$. Furthermore, $C$ will have no effect on your ...
• 16.6k

### Why do problems arise in FFT for smaller value of df in Python?

The discrete Fourier transform for a signal of period $T$ with $N$ samples reads in its inverse or reconstruction form as $$y(t)=\frac1{N}\sum_{k=-N/2}^{N/2}c_k e^{i2\pi k\frac{t}{T}}$$ with ...
• 6,064

### Why not use the convolution theorem for explicit timestepping?

For the linear, constant coefficient advection equation on a torus, one can simply use the exact solution. So there are no "popular" numerical methods for this problem.
• 16.6k

### Problem implementing convolutions exactly with the FFT

It looks to me that the FFT convolution algorithm is doing what is expected here. Remember that you work with discretized signals, and therefore, discretized convolution. There are a few ways to ...
• 281

Accepted

### Does DCT diagonalize the FD discretisation of the Laplacian with Neumann boundary conditions?

The "issue" seems to have been that there is a discrepancy between the used transforms. The DCT transforms discussed in the linked paper are orthogonal, i.e. $U^{-1}=U^T$, where the even one ...
• 2,122

### Obtain velocity from imposed energy spectrum using the inverse FFT

I recommend you first read answer here to find out why $\tilde{E}(\mathbf{k}) \neq \frac{1}{2} \tilde{\mathbf{u}}(\mathbf{k}) \cdot \tilde{\mathbf{u}}(\mathbf{k})$. In order to find velocity profile ...

### My calculated laser pulse duration is too large. Where am I wrong?

Seems like I'm a bit late, but I was just answering a similar question. The first thing here, is that you probably want to pay attention to the definition of the w-axis. The FFT-algorithm will ...
• 256

• 735

### Incorporating a potential barrier in a wave-packet simulation (Fourier Transform method)

The neat thing about Fourier codes is that you can achieve very high order derivatives and if you are describing physics which is about waves, then the trigonometric base functions are a good choice. ...
• 2,935
Accepted

### Power spectrum incorrectly yielding negative values

This is due to an implicit time shift, which corresponds to a phase shift, perceived here as a sign inversion. The signal you are Fourier transforming is symmetric around t=0 and this is why you ...
• 220