# Galerkin Method¶

Suppose we need to find the solution to equation

$\mathcal L_{x} \psi(x) = f(x).$

The key is that the solution can be approximated by

$\psi(x) = \sum_i u_i \phi_i(x),$

where $$\phi_i(x)$$ are the basis functions.

The purpose is to find the the coefficients $$u_i$$. Galerkin method has three steps.

1. discretize the space $$x$$ and function space: triangulation,
2. discretize the function using weak form: assembly,
3. error estimation.

Triangulation is basically setting up the basis function in a discretized space $$x$$. One of the choice is the hat function.

Fig. 4 Triangulation from comsol multiphysics.

At each point $$x$$, there is a hat function responsible for the approximation within $$[x-\Delta x, x+\Delta x]$$.

Those hat functions forms the basis for the approximated solution

$\psi = \sum_i u_i \phi_i.$

With this approximation, it requires the test function $$v$$ to write down the weak form. Basically we multiply $$v$$ on both sides of the equation then integrate by step. Then the differential equation can be rewrite into matrix form with basis $$\phi_i$$,

$\mathbf K \mathbf U = \mathbf L.$

We solve the coefficients $$\mathbf U$$ from the matrix equation.

## References and Notes¶

1. Freitag, K. J. (2007). Neural networks and differential equations.
2. COMSOL Multiphysics has a nice article.

© 2016-2018, Lei Ma | Created with Sphinx and . | | | |