I'm following Paul Constantine's Primer on Stochastic Galerkin Method, Section 3.1 (2D Poisson Example). In this matlab code, the example attempts to solve the PDE $$\alpha(w)(u_{xx}+u_{yy})=1 \text{ in } \Omega=[-1,1]^2$$ $$u=0 \text{ on } \partial\Omega$$ with $\alpha(w)$ a uniformly randomly distributed variable whose values lie in $[1,3]$.

I was able to follow the derivation of the method and its implementation into the matlab available here. Except for one small detail...

In the matlab code, the linear operator $Lu=u_{xx}+u_{yy}$ was discretized by finite difference method using $n=16$ equispaced intervals. In my understanding of the problem, this would mean that $$\Delta x=\frac{2}{n}$$. However, the main program file *poisson_2d.m*, (line 38), he used


I'm almost certain that this is a typo. Even though the stochastic galerkin code is supposedly verified by monte-carlo simulations, even the monte-carlo simulations use a finite difference discretization of $dx=1/n$.

I can't find any other reason to suspect that the spatial discretization of the laplacian for this problem should be $\frac{1}{n}$.

Can anyone, with some experience with this sort of thing, confirm/refute my suspicions?

  • 1
    $\begingroup$ Have you asked the authors of the code? $\endgroup$ Commented Oct 20, 2013 at 2:05

1 Answer 1


I have just corresponded with the author of the software, and my suspicions were confirmed. The spatial stepsize for $n$ equispaced intervals for this problem should be $$\frac{x_{n+1}-x_0 }{n}=\frac{y_{n+1}-y_0}{n}=\frac{2}{n}$$.


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.