I want to write the kinetic energy operator as a matrix within a finite element approach for electrons moving in a crystal with some effective mass that is a function of position. Now usually we have: K = -ħ2/2m d2/dx2 such that the second order derivative of a wavefunction maybe written as: d2/dx2 = 2/(xi+1-xi-1)* (ψi+1-ψi)/(xi+1-xi) - (ψi-ψi-1)/(xi-xi-1)) But for electrons moving in a crystal where the effective mass depends on the spatial coordinate, then the kinetic energy operator is: K = -ħ2/2 d/dx(1/m*(x) d/dx) How can I write this in a finite element approach? Do I just put 1/mi in front of ψi etc.? I tried that but it gives some funny results that do not seem physical. In the problem I am solving the effective mass makes a large jump from one grid point to the next, so maybe this could cause some problems?