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].   
4 (b).   Use the boundary values  [Graphics:Images/GalerkinMod_gr_292.gif]  and  [Graphics:Images/GalerkinMod_gr_293.gif].   

Solution 4 (b).

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

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


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

 

 

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

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


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

 

 

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

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


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

 

 

The residual is formed by substituting  [Graphics:../Images/GalerkinMod_gr_355.gif]  into  [Graphics:../Images/GalerkinMod_gr_356.gif].

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


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

 

 

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

Form the equations  [Graphics:../Images/GalerkinMod_gr_360.gif]    for  [Graphics:../Images/GalerkinMod_gr_361.gif].  

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


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

 

 

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

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


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

 

 

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

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


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

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

 

We are done.  

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

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


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

 

 

Plot the analytic solution.

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


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

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

 

 

Plot both the analytic and Galerkin solution.

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


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

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

 

 

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

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

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

 

[Graphics:../Images/GalerkinMod_gr_381.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_382.gif]


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

 

 

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

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

[Graphics:../Images/GalerkinMod_gr_385.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_386.gif]  are used to form  [Graphics:../Images/GalerkinMod_gr_387.gif]  and there are [Graphics:../Images/GalerkinMod_gr_388.gif] equations to solve  

    [Graphics:../Images/GalerkinMod_gr_389.gif]    for  [Graphics:../Images/GalerkinMod_gr_390.gif].  

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

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

 

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

    [Graphics:../Images/GalerkinMod_gr_395.gif]    for  [Graphics:../Images/GalerkinMod_gr_396.gif].  

The matrix form of the solution is  

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


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

This is the same as we obtained above.  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2005