0
$\begingroup$

I am using Fourier series to find the analytical solution to the 2D heat equation. The problem is that the integrals which are used to calculate the coefficients of the series cannot be solved analytically.

I am currently using GSL's Monte Carlo integration to compute them an this introduces error to the series. My question is will the solution converge to the analytical solution or not? If not, How can I get an estimate of the error?

EDIT

This is my initial condition:

\begin{align} &C_0(x,y) = \left\lbrace \begin{array}{lll} 0 & &r(x,y) \geq 15\\ 4- \dfrac{4}{15} r(x,y) & &r(x,y) < 15 \end{array}\right. \label{ch3-diffusion-2d-circle-init-cond}\\ &r(x,y) = \sqrt{(x-75)^2 + (y-50)^2} \end{align}

and this is the integral:

$$A_{mn}={4\over l_x l_y}\int_0^{l_y} \int_0^{l_x} C_0(x,y)\sin\left({m\pi\, x\over l_x}\right)\sin\left({n\pi\, y\over l_y}\right)\,dx\,dy, \quad \forall m,n \in \aleph$$

where $l_x=l_y = 100$.

This is what I get after 500 iterations:

After 500 iterations

Which hasn't really improved from iteration 100.

$\endgroup$
2
  • $\begingroup$ What is the thing being plotted? There are no axis labels, and it's not clear from context what iteration means. Fourier integrals can sometimes be rewritten as (here) discrete sine transforms, and computed with FFT. $\endgroup$
    – Kirill
    Commented Sep 12, 2015 at 17:00
  • $\begingroup$ @Kirill, This is the $C_0(x,y)$'s plot. By 500 iterations I meant the sums go up to 500 instead if infinity. $\endgroup$
    – Eliad
    Commented Sep 12, 2015 at 21:48

1 Answer 1

1
$\begingroup$

The quadrature formula you should be using depends on the structure of the integrand, i.e., in your case $\int f(x) \sin(kx) \; dx$. For example, if $f(x)$ is smooth, then using a high order Gaussian integration scheme is likely appropriate. If $f(x)$ is discontinuous, then Gauss formulas are not appropriate, but they may be on the individual segments were $f(x)$ is smooth. Without more information about the integrand you have, it is not possible to provide a better answer.

The following is generically true, however: Monte Carlo integration is almost never the appropriate approach unless you are in high dimensional spaces.

$\endgroup$
2
  • $\begingroup$ I updated the question. $\endgroup$
    – Eliad
    Commented Sep 11, 2015 at 15:10
  • $\begingroup$ Your integrand is piecewise smooth. Subdivide the circle into a set of triangles or quadrilaterals and apply Gaussian quadrature there -- you'll get the (almost) exact answers with basically no effort at all. $\endgroup$ Commented Sep 14, 2015 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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