home
PDF (letter size)
PDF (legal size)

Symbolic generating of system equations for 2D regular grid for solving the Laplace equation using finite difference method

Nasser M. Abbasi

Math 228A, UC Davis, Fall 2010   Compiled on May 21, 2020 at 2:30am

\[ \frac{\partial ^2 u}{\partial x^2} + \frac{\partial ^2 u}{\partial x^2} = f(x,y) \]

When solving the above equation using finite difference method on square, in order to make it easy to see the internal structure of the A matrix using the standard 5 points Laplacian scheme, the following is a small function which generates the symbolic format of these equations for a given \(N\), the number of grid points on one edge. At the end of this note, the system equations are generated for \(N=4,5,6,7,8\). One can see the form of the \(A\) matrix with the dominant diagonal.

  1. HTML
  2. PDF
  3. Mathematica notebook