Let us compute the stiffness matrix for the one-dimensional case. In one-dimensional space the gradient has the form , and the dot product of the gradient with itself is . Since the one-dimensional computational domain is partitioned into segment simplices, the part of the functional under study for a single segment can be written as
(6.1)
In the general case the trial function , whereas on a simplex it has the form . Taking into account (5.7) and (5.8) from the section on hat functions, we write the relations for the hat functions
(6.2)
Compute the derivative of the trial function
(6.3)
Note that the derivative does not depend on and is constant on the segment. Substituting (6.3) into (6.1)
where is the length of the segment.
Expand the square and regroup the terms
Let us take into account the formulas from (5.8) for the coefficients and introduce the notation for the elements of the local stiffness matrix of the segment
(6.4)
Thus, the local stiffness matrix for a one-dimensional element has the form
(6.5)
The global stiffness matrix is obtained by summing the contributions from all segments of the mesh by the assembly method: the elements of the local matrices are added to the corresponding elements of the global matrix according to the global node numbering. The dimension of the global stiffness matrix is , where is the total number of mesh nodes.
For example, consider a mesh with nodes . During assembly each segment contributes , and an interior node receives a contribution from the two adjacent segments — and — so its main-diagonal entry is the sum . Since the length depends on the segment index, it cannot be taken out as a common factor — each entry of the global matrix keeps the length of its own segment. As a result the matrix is tridiagonal