We provide a computational piecewise linear regression (CPLR) method with endogenous segmentation to construct accurate mathematical representations of data. The method models the unemployment–inflation relationship through a deterministic segmentation algorithm, rather than imposing a predetermined functional form to fit all data for one time. The CPLR method procedure sequentially fits local linear regressions on observations ordered by the explanatory variable and detects structural breakpoints according to a specific rule of breakpoint detection property in the coefficient of determination. A minimum segment size is imposed to ensure numerical stability constraint, and the optimal minimum sample size is determined by minimizing the global root mean squared error (RMSE) across candidate segmentations. We establish a theoretical property of the CPLR method algorithm, based on the fact that the breakpoint detection rule follows directly from the minimum least-squares error principle rather than from heuristic segmentation. The example results, using annual data from 1991 to 2022 as an illustration, reveal clear structural breaks and regime-dependent slope heterogeneity across the G7 economies. The number of segments varies substantially across countries, ranging from a stable two-segment structure in the United States to a six-segment structure in France. Positive slopes appear in specific unemployment ranges for several countries, except in the case of the United States. Comparisons with the results of conventional linear and nonlinear regressions show that in several countries, including Japan, Germany, Italy, and France, the CPLR representation provides a closer local fit to the observed data than conventional global linear or nonlinear specifications. The CPLR method, therefore, provides a deterministic and data-driven algorithm for detecting endogenous structural changes and constructing accurate piecewise linear representations without imposing prior theoretical assumptions or relying on statistical inference.