# The Galerkin Method in Mathematica

```

in the rectangle (0,1) x (0, 1), subject to the boundary conditions

```

u(x,0)=u(0,y) = 0, u(x,1) = x(1-x), u(1,y) = 0.31 y(1-y)

We use the Galerkin method to approximate the solution to this BVP using Chebyshev polynomials. All of the calculations, from generating the base functions to determining the coefficients of the series expansion of u in terms of the basis functions, are carried out in Mathematica. The first figure shows the contours of u (which are the orbits of typical fluid particles in this flow) where the Chebyshev approximation of u is used.

The next figure shows the contours of u when the "exact" solution is determined by using separation of variables.

The function u is the stream function of the underlying dynamical system. The velocity components of this flow are related to u by dx/dt = u_y and dy/dt = - u_x. We now use NDSolve and determine the evolution of a set of particles that form a disk of radius 0.1 in a corner of the domain under the action of the above system of differential equations. We choose 40 points on the boundary of the disk and follow their evolution in time.

Finally we combine the orbits and parcel evolution.

The Mathematica Program