## 2 Numerical Analysis
### Inverse Determination of the Residual Stresses  
The availability of the displacements at the upper surface when the residual stress is known can be referred to as the \"direct problem\". This tool actually allows us to solve the \"inverse problem\", which consists of finding the residual stress distribution that would produce the actually measured relaxed (or relieved) displacements. In principle, this turns out to be a minimization problem, which consists of finding the best distribution to obtain the minimum differences between the calculated and measured displacements. This minimization can be naturally solved according to the least-squares method due to the linearity between the residual stresses to be found and the relaxed displacements. As schematically shown in Figure 10, the displacements can be interpreted as a superposition of different stress contributions. In particular, if a piecewise-linear distribution of the stresses is assumed, then each step can be seen as the sum of two triangular stress distributions, which  
Figure 9: Example of applying the procedure to obtain the displacements at the top surface: (**a**) stress distribution assumed as known, (**b**) definitions of the stress components and orientation of the output displacements, (**c**) radial and (**d**) tangential obtained displacements.  
in turn can be seen as the scaling of a triangular distribution with the unity value at the maximum and the scaling factor equal to the stress at that vertex.  
At each depth, the simple \(\sigma_{i}\) shown in the figure is actually the term for stresses \(\sigma_{x},\sigma_{y},\tau_{xy}\), or equivalently for stresses \(P,Q,T\); thus, the following linear system can be imposed.  
\[[A]\left[\begin{array}{c}P_{1}\\ Q_{1}\\ T_{1}\\ \vdots\\ P_{n}\\ Q_{n}\\ T_{n}\end{array}\right]=\left[\begin{array}{c}u_{r,1}\\ u_{a,1}\\ \vdots\\ u_{r,i}\\ u_{a,j}\\ \vdots\\ u_{r,N}\\ u_{a,N}\end{array}\right] \tag{5}\]  
The matrix \([A]\) in Equation (5) is \(2N\times 3n\), in which \(n\) is the number of vertexes of the linear piecewise distribution, i.e., the number of stress steps \(+1\), and \(N\) is the number of points detected by the DIC algorithm, for which two displacement components are available. As is obvious from the experimental side, \(N\) needs to be much larger than \(n\) such that \([A]\) is a vertical matrix, otherwise the experimental data would be inappropriate with respect to the number of stress variables to be found. From Equation (5), each single column of the matrix \([A]\) can be found by imposing a unitary component among \(P,Q,T\) and zero all the others, then repeating this for all three components of all the \(n\) stresses. For example, the first column is obtained by calculating the radial and the tangential displacements at the DIC points by imposing \(P_{1}=1\) MPa, \(Q_{1}=0,T_{1}=0,P_{2}=0,\ldots,T_{n}=0\), then the second column is obtained by imposing \(Q_{1}=1\) MPa and zero all the others, and so on. Each of these single distributions of stresses can be solved as a generic imposed stress by applying the algorithm presented above, in which the load is linearly varying and the step depths can be completely unrelated to the mesh points. Since the number of imposed equations (the measured displacements at the DIC points) is larger than the number of unknown stresses to be found, potentially even much larger, the system of equations is inconsistent (or even impossible). The natural way to find a solution is by imposing least-squares minimization, which can be obtained by calculating the pseudo-inverse of the matrix \([A]\) and left-multiplying that by the column of the measured displacements.  
Figure 10: Superposition of triangular unitary stresses, each scaled by a stress term which is the value at the vertex of the piecewise distribution to match the actual (measured) displacements at the upper surface.