I have a $2\pi$-periodic function $f(x)$, and I want to calculate numerically the integral $\int_{0}^{\alpha}f(x)dx$ where $\alpha$ is a point in the interval $[0,2\pi]$. I have the function evaluated in the points of a grid on that interval. I know that schemes like the trapezoidal rule converges spectrally for periodic functions, then I can calculate $\int_{0}^{2\pi}f(x)dx$ accuratelly with the points that I have. However, this rule do not allow me to calculate the integral up to $\alpha$, a point inside the interval, with the accuracy I need. I wonder if there is a scheme that allows me to perform this with spectral accuracy, for example using the fourier transform or something like that.

  • $\begingroup$ What is "spectral accuracy" supposed to mean? Ghostly accuracy, maybe? If it's a sufficiently smooth periodic function, why don't you just compute its Fourier series, and integrate that, term by term? $\endgroup$ – Professor Vector Jun 19 at 19:49
  • $\begingroup$ Yeah, I think they are the same, spectral mean something like exponential convergence in the number of points $\endgroup$ – Almost nice Jun 19 at 20:22

If $u$ is the indicator function of the interval $[0,\alpha]$, you want to compute $$\int_0^{2\pi} u(x) f(x) \; dx = 2 \pi \sum_{n=-\infty} \overline{\hat{u}_n} \hat{f}_n$$ where $\hat{u}_n$ and $\hat{f}_n$ are the Fourier coefficients of $u$ and $f$.

| cite | improve this answer | |
  • $\begingroup$ Should there be a convolution in Fourier space corresponding to the pointwise product in $x$-space? $\endgroup$ – whpowell96 Jun 19 at 19:54
  • $\begingroup$ This is Parseval's theorem. $\endgroup$ – Robert Israel Jun 19 at 19:55
  • $\begingroup$ Ah I see where I was confused. Taking the conjugate of the coefficients of the indicator function is equivalent to the discrete convolution of the Fourier coefficients of $u$ and $f$ $\endgroup$ – whpowell96 Jun 19 at 19:58
  • $\begingroup$ Taking the DFT of a indicator function would not introduce much error? $\endgroup$ – Almost nice Jun 20 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.