# L2-Projection using quadratic basis functions

I am trying to understand 1D $L^2$-projections using quadratic basis functions. Using 3 data points, and the Lagrange polynomial it is easy enough to see how to write out 3 basis functions. With the hat functions from the linear basis, it is easy to see how to expand a function. The hat functions are like delta-functions. With the quadratic basis I am having trouble writing out an explicit expression for the basis function because there are three functions in the same interval. (Fig 8.36 here : https://people.fh-landshut.de/~maurer/femeth/node265.html#SHP3).

The next step of what I am looking to do is construct the so called "mass matrix". Is there a way to visualize the quadratic basis like a hat-function? Once the basis functions are known, the mass matrix elements can be computed by looking at the overlap between the basis functions, L2-inner product.

Mass matrix structure for the linear-hat functions (x's denote a non-zero entry):

Edit:

This information is based off of the accepted answer below, which gives good references for figuring this out.

Structure of the mass matrix with quadratic basis functions:

• I don't understand your question. Are you trying to visualize the quadratic interpolation functions? If that's the case, the figure you ever to is av depiction of them. It also seems that you are trying to program the Finite Element Method. Mar 15 '15 at 3:59
• Yes ultimately I am learning about the finite element method. Before I get there though, I am learning about just L^2-projection. I know how to plot the quadratic interpolation functions. I understand how to use them to approximate a function with 3-nodes. But I am unsure how to extend the quadratic interpolation functions to a larger range say k+1 points. Is this something that can be done? I've done it for the linear interpolation functions. I don't understand how to think of these 3-functions as a single basis function, for which I can compute the mass matrix.
– wgwz
Mar 15 '15 at 13:24
• Let me rephrase that. You have 3 questions: 1) Is it possible to use higher order polynomials for the FEM?, 2) How do you interpolate a function, or, how do you find the coefficients for the linear combination of basis functions?, 3) After knowing how to interpolate, how to form the _mass matrix? Am I right? All these questions have answers, but please rewrite your question. Mar 15 '15 at 14:35
• @nicoguaro Hi, I am not asking 1). Yes, for 2.) and 3.). The post below has helped me with some of my confusion.
– wgwz
Mar 19 '15 at 2:24

With linear elements, you put the shape functions together into little hat-shaped basis functions and overlap them like this:

With quadratic shape functions, you do something similar and overlap them in a similar way, but you gain an interior point inside the element that doesn't overlap with its neighboring element:

• Does the mass matrix become 5-diagonal? In the linear element case the mass matrix is tri-diagonal (3-diagonal). Is there an exact quadrature rule for a 4th order polynomial? (The mass matrix is the product of two 2nd order polynomials).
– wgwz
Mar 19 '15 at 2:10
• Yes. Though the interior degrees of freedom only have 3 non-zeros per row since they only overlap with their co-element DOFs. And yes, there are exact quadrature rules for quartics (e.g. a 3-point Gauss rule integrates up to quintics exactly). Mar 19 '15 at 12:41
• Can you take a look the structure of the mass matrix I have? It's shown in the original post. I suppose it's incorrect, as I have some rows with 5 non-zeros. Looking at the quadratic basis functions you posted, it seems that $M_{3,4} = (\phi_3, \phi_4)$ certainly has some overlap and hence a non-zero value. Whereas an entry like $M_{4,6}$ is a not for basis functions with common support so it is zero. Perhaps I viewing these functions the wrong way. The picture I posted shows non-zero values as x's.
– wgwz
Mar 19 '15 at 14:59
• That's exactly what I said you should expect. 3 non-zeros per row for the interior DOFs and 5 for the DOFs on element boundaries. Mar 19 '15 at 15:14