Sample codes

Codes for 1D boundary value problems:

Matlab Python
 Homogeneous Dirichlet newd2.m 
Inhomogeneous Dirichlet newliftedd1.m 
Mixed (Neumann/Dirichlet) 
 Variable coefficients - a Sturm-Liouville problem 

The following codes solve a homogeneous Dirichlet problem in 2D (the python file contains all three routines):

Matlab Python
 Construct grid  uniform_grid.m 
 Assembly newassemble.m  

Suggested exercises

Problem 4 of the 2015 exam and problem 1 of the 2014 kont are classic 1D problems (using homogeneous Dirichlet conditions)

The finite element problems from 2017, 2014 and 2013 are also relevant, but cover Robin boundary conditions, which are not pensum. Nonetheless, it is not significantly more difficult to handle this case, so these could still be useful practice, especially as Neumann conditions can be considered a special case. However, you may need to consult the solutions once to see how this is done.

To find a relevant 2D problem we must look back to the 2012 exam (problem 4).

I did not see any treatment of inhomogeneous Dirichlet conditions in the 1D case, if there is demand I will make a practice exercise.

2018-05-04, Charles Henry Alexander Curry