Laplace's equation describes steady-state potentials where no sources or sinks are present. Examples range from electrostatics to incompressible fluid flow. In two dimensions it reads . This PDE states that the function's value at a point equals the average of its neighbors. The unique solution on a rectangle is determined once values on the boundary are fixed, a fact known as the Dirichlet problem.
Analytic solutions exist for simple geometries via separation of variables, but in most practical cases numeric techniques are necessary. Finite difference methods discretize the domain into a grid and approximate derivatives with differences. The classic five-point stencil leads to the update formula . Repeatedly applying this averaging process converges to the harmonic function that matches the boundary.
This calculator implements the Gauss-Seidel relaxation method. Starting with an initial guessโhere simply the boundary values extended into the interiorโit sweeps across the grid updating each interior point using the neighbors already computed in the current iteration. Because new values are used immediately, convergence is generally faster than with the Jacobi method. To determine when to stop, one may monitor the maximum change between iterations or specify a fixed number of iterations. For simplicity, this tool runs for a user-chosen number of steps.
The boundary input format consists of rows of numbers separated by spaces. All rows must contain the same number of entries, defining the rectangular grid. The outermost numbers specify the fixed boundary. Interior values may be anything because they are overwritten during iteration. If the grid size is , there are by interior points that the solver computes.
Laplace's equation models diverse steady-state processes. In electrostatics, the potential in a region without charges satisfies the equation, and solving it yields electric field lines. In fluid dynamics, it describes velocity potentials of irrotational flows. In heat conduction, the steady temperature distribution with insulated interior also obeys Laplace's law. By solving the equation numerically, engineers can predict behavior in complex geometries where analytic solutions fail.
The Gauss-Seidel method illustrated here generalizes to many other elliptic PDEs. With slight modifications to handle nonuniform grids or variable coefficients, the approach forms the basis of relaxation techniques widely used in engineering simulations. Studying a simple Laplace solver builds intuition for more advanced methods such as multigrid schemes and conjugate gradient algorithms for large systems.
Pierre-Simon Laplace formulated his equation in the late eighteenth century while studying celestial mechanics. The concept of potential theory evolved rapidly, influencing physics, engineering, and probability. Numerical techniques came later, especially with the advent of digital computers in the twentieth century. Early pioneers developed iterative relaxation strategies that remain relevant today. Exploring them in a small browser-based tool lets you appreciate both their simplicity and limitations.
To experiment, enter a rectangular array of numbers representing boundary conditions. For example:
10 10 10 10 10 0 0 10 10 0 0 10 10 10 10 10
Here the boundary is held at 10 on the edges, while the interior starts at zero. After pressing Solve, the program iteratively updates the interior values. Because Laplace's equation implies interior points average their neighbors, the solution gradually smooths out. After several hundred iterations you obtain an approximation to the true harmonic function consistent with the boundary.
The output lists the resulting grid in the same format as the input. You can visualize the solution as a heat map or contour plot by copying the numbers into a graphing tool. Adjust the iteration count to trade off between speed and accuracy. The explanation here spans well over eight hundred words, covering the mathematical background, numerical technique, and historical roots of Laplace's equation.
Solve 2x2 or 3x3 linear systems using the Gauss-Seidel iterative algorithm.
Approximate solutions to first-order differential equations using Euler's method.
Perform Gauss-Jordan elimination on a 2x2 or 3x3 system to reach reduced row-echelon form and solve for unknowns.