I am solving some 2nd order differential equations using the finite element method. Doing so I represent the second order derivative at a given point as: ∂2ψi/∂x2 = 1/(Δx)2 (ψi-1+ψi+1-2ψi) And solve the differential equation by setting up a matrix of N entries and solving for the eigenvectors. I guess you are all familiar with this approach. Now what I want to do is use a nonuniform mesh. To do so I have tried to simply let Δx = Δxi, i.e. such that it may vary depending on the site i. But doing so I get some solutions that don't make sense, which I assume is because of the "discontinuity" in the mesh size. How can I approach the problem of a nonuniform mesh size?