The function that describes the behaviour on a simplex is called a test function — probably because in the early days of the method, given how weak computing hardware was, one had to try out and tune functions that would approximate the solution. There is a vast number of test functions — one can even use trigonometric ones — but in practice polynomial functions became the common choice, which hints at expanding the solution in a Taylor series, by analogy with the expansion in a Fourier series, with the sole difference that we carry out the Taylor expansion not over the whole geometry, but only on the simplices, which lets us use the simplest possible polynomials. As a rule, polynomials of degree 3 were chosen, with 9–10 coefficients, and this required adding extra points to the simplex in order to determine those coefficients, which led to 9–10 systems of linear equations on each simplex; but they had to be solved only once, which, computationally, is not a problem even by the standards of that time. This is, of course, a sound approach, but I decided to “try” building the solution with the simplest possible polynomials, namely polynomials of the form:
where is the number of nodes, are the coefficients, are the so-called “hat” functions, which equal 1 at a node of the simplex and 0 at the remaining nodes of the geometry; and it is precisely because the “hat” functions are polynomials that the test functions, too, will be polynomials.
where is the node index, not a power, are the coefficients that depend on the geometry of the particular node on the simplex. Once the geometry has been partitioned into simplices, they will need to be computed once for each node of the simplex. I wrote the “hat” function for a three-dimensional coordinate system, but further on we will work with the two-dimensional or one-dimensional case in the same way.
Let us discuss the “hat” functions in more detail and start with the one-dimensional case.
In figure “Hat” functions for segment simplices five “hat” functions are shown — and four simplices: in total, for one-dimensional space, over points there are “hat” functions and simplices, respectively. At the ends, at the nodes and , the functions take the form of half-“hats”. Let us take ; then the simplex between the points and (in the figure it is highlighted with a fill and bounded by dashed lines) is defined as follows: , since the remaining “hat” functions have no effect on it because they take the value zero on the interval . The function passes through the points and , and the function through the points and . Then the following holds
The solutions of the systems are, respectively
If for one-dimensional simplices the “hat” functions look like lines in the plane, then for two-dimensional simplices they become surfaces in three-dimensional space.
We took all three vertices of the triangle from figure Triangle simplices and built three pyramids whose apexes are the vertices of the original triangle “raised” by 1, while the bases of the pyramids are the polygons from the same figure that contain the triangle’s vertices inside them. Since the triangle under study is and we intend to write the test function for it, let us discard the extra parts and redraw the figure, keeping only the planes that project onto the triangle.
In figure Parts of the “hat” functions for a triangle simplex for two-dimensional space, just as for the one-dimensional case, to each of the mesh nodes there corresponds exactly one “hat” function, so there are of them in total; the number of triangle simplices, however, depends on the particular triangulation. Note also that within a single triangle exactly three “hat” functions are nonzero — one for each of its vertices. Let us denote the vertices of the simplex by . As a result, the test function takes the form . To determine the constants , , let us take into account that the coordinate is nonzero only at the apexes of the pyramids; as a result, we obtain three systems of equations
The solutions of the equations are, respectively
where is the determinant of the matrix.
The difficulty of working with a three-dimensional coordinate system is that the solution, like the “hat” functions, is hard to visualise, so we will make do with formulas alone. In general, this guide places its main emphasis on two-dimensional boundary-value problems, since, unlike the one-dimensional ones, they are not trivial and at the same time visualise well. So, in three-dimensional space a tetrahedron serves as the base of a four-dimensional pentachoron-“hat”. By analogy with the formulas above, we venture to assume that the “hat” function will take the value 1 at one of the vertices of the tetrahedron — raised into four-dimensional space perpendicular to the base — and be zero at the remaining nodes of the tetrahedralization; the test function then takes the form . To determine the constants , , , let us take into account that the coordinate of the fourth dimension is nonzero only at the apexes of the pentachora; as a result, we obtain four systems of equations
The solutions of the equations are, respectively
where the determinant of the matrix is: