Example 4.  Solve   [Graphics:Images/GalerkinMod_gr_289.gif].  
4 (a).   Use the boundary values  [Graphics:Images/GalerkinMod_gr_290.gif]  and  [Graphics:Images/GalerkinMod_gr_291.gif].   

Solution 4 (a).

Form the linear operator, the differential equation and the boundary values.

[Graphics:../Images/GalerkinMod_gr_294.gif]


[Graphics:../Images/GalerkinMod_gr_295.gif]

 

 

The first function [Graphics:../Images/GalerkinMod_gr_296.gif] will be chosen to be the straight line between the boundary points.

[Graphics:../Images/GalerkinMod_gr_297.gif]


[Graphics:../Images/GalerkinMod_gr_298.gif]

 

 

The other n function [Graphics:../Images/GalerkinMod_gr_299.gif] will be chosen to be zero at the endpoints.

[Graphics:../Images/GalerkinMod_gr_300.gif]


[Graphics:../Images/GalerkinMod_gr_301.gif]

 

 

The residual is formed by substituting  [Graphics:../Images/GalerkinMod_gr_302.gif]  into  [Graphics:../Images/GalerkinMod_gr_303.gif].

[Graphics:../Images/GalerkinMod_gr_304.gif]


[Graphics:../Images/GalerkinMod_gr_305.gif]

 

 

Galerkin's requirement is that the inner product of the residual with [Graphics:../Images/GalerkinMod_gr_306.gif] is zero.

Form the equations  [Graphics:../Images/GalerkinMod_gr_307.gif]    for  [Graphics:../Images/GalerkinMod_gr_308.gif].  

[Graphics:../Images/GalerkinMod_gr_309.gif]


[Graphics:../Images/GalerkinMod_gr_310.gif]

 

 

We must solve for the coefficients   [Graphics:../Images/GalerkinMod_gr_311.gif].

[Graphics:../Images/GalerkinMod_gr_312.gif]


[Graphics:../Images/GalerkinMod_gr_313.gif]

 

 

Use  [Graphics:../Images/GalerkinMod_gr_314.gif]  to form the Galerkin solution.

[Graphics:../Images/GalerkinMod_gr_315.gif]


[Graphics:../Images/GalerkinMod_gr_316.gif]

[Graphics:../Images/GalerkinMod_gr_317.gif]

 

We are done.  

Aside.  We can use Mathematica to find the analytic solution.  This is just for fun !

[Graphics:../Images/GalerkinMod_gr_318.gif]


[Graphics:../Images/GalerkinMod_gr_319.gif]

 

 

Plot the analytic solution.

[Graphics:../Images/GalerkinMod_gr_320.gif]


[Graphics:../Images/GalerkinMod_gr_321.gif]

[Graphics:../Images/GalerkinMod_gr_322.gif]

 

 

Plot both the analytic and Galerkin solution.

[Graphics:../Images/GalerkinMod_gr_323.gif]


[Graphics:../Images/GalerkinMod_gr_324.gif]

[Graphics:../Images/GalerkinMod_gr_325.gif]

 

 

Check out the difference between the analytic solution and the Galerkin solution.

[Graphics:../Images/GalerkinMod_gr_326.gif]


[Graphics:../Images/GalerkinMod_gr_327.gif]

[Graphics:../Images/GalerkinMod_gr_328.gif]

 

So the Galerkin solution appears to be good.

Caution.  We proceed with caution when using Galerkin's method because the linear system might be ill conditioned.

[Graphics:../Images/GalerkinMod_gr_329.gif]


[Graphics:../Images/GalerkinMod_gr_330.gif]

 

 

    The condition number of the above system can be determined by Mathematica.

[Graphics:../Images/GalerkinMod_gr_331.gif]

[Graphics:../Images/GalerkinMod_gr_332.gif]
[Graphics:../Images/GalerkinMod_gr_333.gif]

The condition number is small, we should expect a good solution.

Aside.  We can check out the matrix form for setting up the Galerkin equations.  This is just for fun !  

The boundary values  [Graphics:../Images/GalerkinMod_gr_334.gif]  are used to form  [Graphics:../Images/GalerkinMod_gr_335.gif]  and there are [Graphics:../Images/GalerkinMod_gr_336.gif] equations to solve  

    [Graphics:../Images/GalerkinMod_gr_337.gif]    for  [Graphics:../Images/GalerkinMod_gr_338.gif].  

[Graphics:../Images/GalerkinMod_gr_339.gif]

[Graphics:../Images/GalerkinMod_gr_340.gif]

 

Since the linear operator is   [Graphics:../Images/GalerkinMod_gr_341.gif] we have [Graphics:../Images/GalerkinMod_gr_342.gif] which must be entered into the integrals on the right hand side.

    [Graphics:../Images/GalerkinMod_gr_343.gif]    for  [Graphics:../Images/GalerkinMod_gr_344.gif].  

The matrix form of the solution is  

[Graphics:../Images/GalerkinMod_gr_345.gif]


[Graphics:../Images/GalerkinMod_gr_346.gif]

This is the same as we obtained above.  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2005