100 Exercises / numerical computation / Numerical Computation: 100 Exercises
Introduction to Interpolation and Approximations in Manufacturing | Estimating Quality Curves Using Python from Sparse Process Measurements
Compare interpolation and approximation in Python; explore how nodes, noise, degree, and validation affect heat-treatment strength predictions.
Using a fictional heat-treatment process, we estimate continuous quality curves from a small set of measurements. The examples compare interpolation, approximation, and regression for temperature settings, quality prediction, and validation planning.
Note This material was adapted from notebooks used in corporate training by Surikobo or its representative, Hiroshi Wayama, with permission from the participating companies.
All examples use fictional data, not records from real companies or factories.
Introduction: Practical Challenges in Manufacturing Covered in This Article
When determining heat treatment conditions, it is not possible to test at all temperatures. There are constraints on test specimens, equipment time, and inspection costs, with only a few temperature and strength points at hand. On the other hand, the field requires quality of unmeasured temperatures, operating ranges that meet the minimum standards, and smooth target trajectories delivered to the controller.
Therefore, this article addresses “how to fill in the gaps between measurement points,” “how to extract trends from point clouds containing noise,” and “how to reflect uncertainty in estimated results in judgment.”
Common situations on site
- The temperature measured in the experimental design is limited to 5–8 levels
- Sensor values have measurement errors, and quality can vary even under the same conditions.
- PLCs and simulators require reference tables for continuous values.
- Extending the curve beyond the measurement range and making weakly supported extrapolation
- Mistaking Smooth Graphs for the ‘Correct Process Model’
Why is this issue so difficult to judge?
Interpolation generally passes through known points but does not guarantee the true value between points. Approximation does not always pass through points; instead, it averages out noise to represent the overall trend. Furthermore, even within the same point group, the curve changes depending on the method, degree, node placement, and boundary conditions. Therefore, it is necessary to first decide whether to place the objective on “display,” “control,” “prediction,” or “cause explanation.”
Overview of the Exercises
| No. | Theme | Main Applications in Manufacturing |
|---|---|---|
| 051 | Lagrange interpolation | Reference curve passing through a small number of calibration points |
| 052 | Newton interpolation | Continuous updates when adding measurement points |
| 053 | spline interpolation | Localized and smooth process curves |
| 054 | least squares approximation | Extracting overall trends from variability |
| 055 | Chebyshev Approximation | Suppresses maximum error across the entire section |
| 056 | Bézier curve | Design of transport and robot trajectories |
| 057 | Fourier approximation | Representation of periodic equipment fluctuations |
| 058 | polynomial approximation | Comparison of Order and Generalization Performance |
| 059 | interpolation error | Determining the placement of additional measurement points |
| 060 | Differences from Regression | Distinguishing between interpolation, approximation, and regression |
Preparing the Python environment
Run the cells in order in Jupyter Notebook. [IN: n] identifies a code cell; [OUT: n] contains its tables, values, and figures. Low-order digits and runtimes may vary with library versions, BLAS, and hardware.
NumPy performs numerical computations, pandas tables, SciPy interpolate, and matplotlib visualization. Random seed is fixed so that the same result can be reproduced.
Show setup code: libraries and display settings
%matplotlib inline
import platform
from IPython.display import display
import numpy as np
import pandas as pd
pd.set_option("display.max_colwidth", None)
import matplotlib
import matplotlib.pyplot as plt
import japanize_matplotlib
from scipy.interpolate import BarycentricInterpolator, CubicSpline
rng = np.random.default_rng(20260712)
pd.set_option("display.precision", 3)
print(f"Python: {platform.python_version()}")
print(
f"NumPy: {np.__version__}, pandas: {pd.__version__}, matplotlib: {matplotlib.__version__}"
)
Python: 3.14.4
NumPy: 2.5.1, pandas: 3.0.3, matplotlib: 3.11.0
Creating the Fictional Data
We define a fictional relationship between furnace temperature and tensile strength . The known function is used only to explain the methods and measure error; it would be unknown in an actual experiment. We generate five noise-free calibration points and 18 noisy experimental points, plus separate examples for periodic signals and transport paths.
Show setup code: generate the fictional data
def true_strength(temp):
x = (np.asarray(temp) - 800.0) / 100.0
return 930 + 85 * x - 48 * x**2 + 8 * np.sin(2.5 * x)
temp_cal = np.array([700, 750, 800, 850, 900], dtype=float)
strength_cal = true_strength(temp_cal)
temp_dense = np.linspace(700, 900, 401)
temp_exp = np.linspace(705, 895, 18)
strength_exp = true_strength(temp_exp) + rng.normal(0, 8, len(temp_exp))
data_df = pd.DataFrame(
{"set_temperature_℃": temp_exp, "tensile_strength_MPa": strength_exp}
)
display(data_df.head(8))
plt.figure(figsize=(8, 4.2))
plt.scatter(
temp_exp,
strength_exp,
label="Experimental values including variation",
color="tab:blue",
)
plt.plot(
temp_dense,
true_strength(temp_dense),
label="True values for evaluation",
color="black",
linestyle="--",
)
plt.title("Fictional heat treatment experiment data")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| set_temperature_℃ | tensile_strength_MPa | |
|---|---|---|
| 0 | 705.000 | 806.289 |
| 1 | 716.176 | 823.553 |
| 2 | 727.353 | 838.499 |
| 3 | 738.529 | 854.902 |
| 4 | 749.706 | 870.813 |
| 5 | 760.882 | 886.412 |
| 6 | 772.059 | 895.513 |
| 7 | 783.235 | 915.293 |

No.051: Lagrange Interpolation
Practical Use
Lagrange interpolation constructs a polynomial through all calibration points. It provides a simple reference curve for estimating strength between measured temperatures.
Model and Method
For nodes , the interpolated polynomial is
The polynomial satisfies . At high degree, poorly placed nodes can produce large oscillations near the interval ends. Passing through the nodes does not justify extrapolation.
Check with Python
lag_poly = BarycentricInterpolator(temp_cal, strength_cal, rng=0)
lag_pred = lag_poly(temp_dense)
check_051 = pd.DataFrame(
{
"temperature_℃": temp_cal,
"measured_MPa": strength_cal,
"interpolation_MPa": lag_poly(temp_cal),
"difference_MPa": lag_poly(temp_cal) - strength_cal,
}
)
display(check_051.round(6))
plt.figure(figsize=(8, 4.2))
plt.plot(
temp_dense, true_strength(temp_dense), "k--", label="True values for evaluation"
)
plt.plot(temp_dense, lag_pred, label="Lagrange interpolation")
plt.scatter(temp_cal, strength_cal, color="tab:red", label="calibration points")
plt.title("Lagrange interpolation: A curve passing through a calibration point")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| temperature_℃ | measured_MPa | interpolation_MPa | difference_MPa | |
|---|---|---|---|---|
| 0 | 700.0 | 792.212 | 792.212 | -0.0 |
| 1 | 750.0 | 867.908 | 867.908 | -0.0 |
| 2 | 800.0 | 930.000 | 930.000 | -0.0 |
| 3 | 850.0 | 968.092 | 968.092 | -0.0 |
| 4 | 900.0 | 971.788 | 971.788 | -0.0 |

Interpreting the Results
The difference in calibration points is almost zero, confirming that the conditions are met. However, passing through a point does not mean that the physical phenomena between points are correct. When adopted, the maximum error is limited to the measurement range, and the maximum error is evaluated with additional verification points.
No.052: Newton Interpolation
Practical Use
In the development process where experimental points are added sequentially, Newton’s format is convenient because you can add new divided-difference coefficients without rebuilding the entire formula.
Model and Method
Using the divided difference ,
It is the same interpolated polynomial as Lagrange format, but the update structure when adding points differs.
Check with Python
def divided_differences(x, y):
coef = np.array(y, dtype=float).copy()
for j in range(1, len(x)):
coef[j:] = (coef[j:] - coef[j - 1 : -1]) / (x[j:] - x[:-j])
return coef
def newton_eval(x_eval, x_nodes, coef):
value = np.zeros_like(np.asarray(x_eval), dtype=float) + coef[-1]
for k in range(len(coef) - 2, -1, -1):
value = coef[k] + (np.asarray(x_eval) - x_nodes[k]) * value
return value
coef4 = divided_differences(temp_cal[:4], strength_cal[:4])
coef5 = divided_differences(temp_cal, strength_cal)
display(
pd.DataFrame(
{"degree": range(5), "5Difference factor for a point": coef5}
).round(6)
)
plt.figure(figsize=(8, 4.2))
plt.plot(
temp_dense, newton_eval(temp_dense, temp_cal[:4], coef4), label="Four calibration points"
)
plt.plot(temp_dense, newton_eval(temp_dense, temp_cal, coef5), label="After adding 900 °C")
plt.scatter(temp_cal, strength_cal, color="tab:red", label="calibration points")
plt.title("Newton Interpolation: Updates by Adding Measurement Points")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| degree | 5Difference factor for a point | |
|---|---|---|
| 0 | 0 | 7.922e+02 |
| 1 | 1 | 1.514e+00 |
| 2 | 2 | -2.721e-03 |
| 3 | 3 | -1.400e-05 |
| 4 | 4 | 0.000e+00 |

Interpreting the Results
Adding a node generally changes the divided differences and interpolating curve. In this example, the symmetric nodes and function make the fourth-order coefficient zero to rounding accuracy. The four-point and five-point curves therefore almost coincide, even after adding 900 °C. For comparison, the code recomputes both coefficient arrays. Measurements used for incremental updates must have comparable measurement conditions.
No.053: Spline Interpolation
Practical Use
If you want to smoothly connect while maintaining localized shapes for each temperature range, cubic splines are a strong choice. Suitable for generating calibration tables and smooth set values.
Model and Method
A cubic spline uses a cubic polynomial on each interval and matches function values and first and second derivatives at interior nodes. A natural spline sets the second derivative to zero at both endpoints. This piecewise representation avoids using one high-degree polynomial over the entire interval.
Check with Python
spline = CubicSpline(temp_cal, strength_cal, bc_type="natural")
spline_pred = spline(temp_dense)
compare_053 = pd.DataFrame(
{
"technique": ["Lagrange", "Natural cubic spline"],
"maximum_absolute_error_within_the_section_MPa": [
np.max(np.abs(lag_pred - true_strength(temp_dense))),
np.max(np.abs(spline_pred - true_strength(temp_dense))),
],
}
)
display(compare_053.round(3))
plt.figure(figsize=(8, 4.2))
plt.plot(
temp_dense, true_strength(temp_dense), "k--", label="True values for evaluation"
)
plt.plot(temp_dense, spline_pred, label="Natural cubic spline")
plt.scatter(temp_cal, strength_cal, color="tab:red", label="calibration points")
plt.title("Spline interpolation: local and smooth estimation")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| technique | maximum_absolute_error_within_the_section_MPa | |
|---|---|---|
| 0 | Lagrange | 0.551 |
| 1 | Natural cubic spline | 1.646 |

Interpreting the Results
On the 401-point evaluation grid, the maximum absolute errors are about 0.551 MPa for Lagrange interpolation and 1.646 MPa for the natural cubic spline. A spline is not automatically more accurate. Check whether zero endpoint second derivatives suit the function, or whether known endpoint slopes should be supplied. These are grid-based maxima, not rigorous bounds over the continuous interval.
No.054: Least Squares Approximation
Practical Use
When experimental measurements vary, interpolation through all points reproduces noise down to the source. Least squares approximation can be used for quality trends, management baselines, and sensitivity estimates.
Model and Method
For model , the sum of squares of the residual
Here, temperature is centered and scaled to improve numerical conditioning, and a quadratic model is fitted. Convert coefficients back to the original units before interpreting their practical meaning.
Check with Python
x_exp = (temp_exp - 800) / 100
coef_ls = np.polyfit(x_exp, strength_exp, deg=2)
ls_pred = np.polyval(coef_ls, (temp_dense - 800) / 100)
resid = strength_exp - np.polyval(coef_ls, x_exp)
metrics_054 = pd.DataFrame(
{
"indicator": ["RMSE", "mean residual", "Maximum absolute residual"],
"value_MPa": [
np.sqrt(np.mean(resid**2)),
np.mean(resid),
np.max(np.abs(resid)),
],
}
)
display(metrics_054.round(3))
plt.figure(figsize=(8, 4.2))
plt.scatter(temp_exp, strength_exp, label="experimental value", color="tab:blue")
plt.plot(
temp_dense, ls_pred, label="Quadratic least squares", color="tab:orange"
)
plt.title("Least squares approximation: extracting overall trends from variation")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| indicator | value_MPa | |
|---|---|---|
| 0 | RMSE | 5.247 |
| 1 | mean residual | -0.000 |
| 2 | Maximum absolute residual | 9.420 |

Interpreting the Results
The approximate curve does not pass through each point, but the average residual is almost zero, representing the overall trend. RMSE is a guideline for “typical deviation.” When determining conditions near the lower limit of the standard, not only average forecasts but also prediction intervals and safety margins are established.
No.055: Chebyshev Approximation
Practical Use
For calibration and embedded calculations where you want to avoid extremely poor errors over the entire interval, the Chebyshev polynomial is effective. It also has the advantage of being higher-order and more numerically manageable than the monomial basis.
Model and Method
Chebyshev polynomials on satisfy . Chebyshev nodes cluster near the endpoints and can reduce endpoint oscillation. We compare them with the same number of equally spaced nodes.
Check with Python
n_nodes = 8
z_equal = np.linspace(-1, 1, n_nodes)
z_cheb = np.cos((2 * np.arange(n_nodes) + 1) * np.pi / (2 * n_nodes))
t_equal = 800 + 100 * z_equal
t_cheb = 800 + 100 * z_cheb
p_equal = BarycentricInterpolator(t_equal, true_strength(t_equal))(temp_dense)
p_cheb = BarycentricInterpolator(t_cheb, true_strength(t_cheb))(temp_dense)
err_055 = pd.DataFrame(
{
"node": ["Evenly spaced", "Chebyshev"],
"maximum_absolute_error_MPa": [
np.max(np.abs(p_equal - true_strength(temp_dense))),
np.max(np.abs(p_cheb - true_strength(temp_dense))),
],
}
)
display(err_055.round(4))
plt.figure(figsize=(8, 4.2))
plt.plot(
temp_dense,
np.abs(p_equal - true_strength(temp_dense)),
label="Equally spaced nodes",
)
plt.plot(temp_dense, np.abs(p_cheb - true_strength(temp_dense)), label="Chebyshev Node")
plt.title("Comparison of interpolation errors due to node placement")
plt.xlabel("set_temperature (℃)")
plt.ylabel("absolute_error (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| node | maximum_absolute_error_MPa | |
|---|---|---|
| 0 | Evenly spaced | 1.900e-03 |
| 1 | Chebyshev | 6.000e-04 |

Interpreting the Results
By comparing with maximum error, you can identify the worst areas that cannot be seen by the average error alone. If the experimental temperature can be freely arranged, it becomes a candidate for improving accuracy, including at the ends. However, you must not demand a temperature that cannot be chosen solely by mathematical nodes due to safety or equipment constraints.
No.056: Bézier Curve
Practical Use
The Bézier curve is a concept that intuitively designs the paths of robots and transport devices at control points. It is suitable for controlling the tangent direction between the start and end points, rather than passing point interpolation.
Model and Method
The cubic Bézier curve uses control point
The curve generally does not pass through the two interior control points. It stays inside the convex hull of all control points, which can help with preliminary clearance checks.
Check with Python
P = np.array([[0.0, 0.0], [1.5, 2.8], [4.0, 2.4], [5.5, 0.5]])
tau = np.linspace(0, 1, 201)
B = (
((1 - tau) ** 3)[:, None] * P[0]
+ (3 * (1 - tau) ** 2 * tau)[:, None] * P[1]
+ (3 * (1 - tau) * tau**2)[:, None] * P[2]
+ (tau**3)[:, None] * P[3]
)
path_length = np.sum(np.linalg.norm(np.diff(B, axis=0), axis=1))
display(
pd.DataFrame(
{"indicator": ["Approximate Route Length"], "value_m": [path_length]}
).round(3)
)
plt.figure(figsize=(7, 4.5))
plt.plot(B[:, 0], B[:, 1], label="Bézier path", linewidth=2)
plt.plot(P[:, 0], P[:, 1], "o--", label="Control polygon")
plt.title("Cubic Bézier path for a conveyor")
plt.xlabel("x position (m)")
plt.ylabel("y position (m)")
plt.grid(True, alpha=0.3)
plt.axis("equal")
plt.legend()
plt.tight_layout()
plt.show()
| indicator | value_m | |
|---|---|---|
| 0 | Approximate Route Length | 6.831 |

Interpreting the Results
By moving the intermediate control point, you can adjust the curvature and approach direction without changing the starting and ending points. However, this figure alone cannot guarantee speed, acceleration, jerk, obstacle margin, or mechanical limits. For actual machine installation, time parameterization and collision verification are performed separately.
No.057: Fourier Approximation
Practical Use
Periodic fluctuations such as equipment load, ambient temperature, and electricity consumption can be expressed as the sum of sine and cosine. Separating periodic components makes it easier to distinguish between baseline and anomalous fluctuations.
Model and Method
Signal from period
This is a truncated Fourier approximation. The more you increase the , the more it follows, but it also picks up noise. Here, signals containing 24-hour and 8-hour components are estimated with least squares.
Check with Python
hour = np.arange(0, 7 * 24)
load = (
60
+ 9 * np.sin(2 * np.pi * hour / 24)
+ 4 * np.cos(2 * np.pi * hour / 8)
+ rng.normal(0, 2, len(hour))
)
Xf = np.column_stack(
[np.ones(len(hour))]
+ [f(2 * np.pi * k * hour / 24) for k in range(1, 4) for f in (np.cos, np.sin)]
)
beta_f, *_ = np.linalg.lstsq(Xf, load, rcond=None)
load_fit = Xf @ beta_f
display(
pd.DataFrame(
{
"indicator": [
"standard deviation of the original signal",
"residual standard deviation",
],
"value": [np.std(load), np.std(load - load_fit)],
}
).round(3)
)
plt.figure(figsize=(9, 4.2))
plt.plot(hour, load, label="equipment load", alpha=0.55)
plt.plot(hour, load_fit, label="Fourier fit with three harmonics", linewidth=2)
plt.title("Fourier Approximation of Periodic Equipment Load")
plt.xlabel("elapsed_time (h)")
plt.ylabel("equipment load (%)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| indicator | value | |
|---|---|---|
| 0 | standard deviation of the original signal | 7.191 |
| 1 | residual standard deviation | 1.974 |

Interpreting the Results
If the residual standard deviation decreases, it can explain periodic reference variations. When using residuals for anomaly monitoring, it is important to separate non-cyclical factors such as days of the week, operating calendars, and product changeovers, and not to mix downtime with normal operation.
No.058: Polynomial Approximation
Practical Use
While polynomials are easy to implement, simply increasing their degree does not always mean the answer is sufficient. When selecting process condition formulas, evaluation is conducted separately by matching training data and reproducibility on unused data.
Model and Method
Data is divided into training and validation, and RMSE is compared for every degree. At higher orders, even if the training error decreases, the validation error may increase, which is a sign of overfitting. Centralization and scaling reduce the ill-conditioning of coefficient calculations.
Check with Python
train_idx = np.arange(len(temp_exp)) % 3 != 0
x_scaled = (temp_exp - 800) / 100
rows = []
for degree in range(1, 9):
c = np.polyfit(x_scaled[train_idx], strength_exp[train_idx], degree)
pred_train = np.polyval(c, x_scaled[train_idx])
pred_valid = np.polyval(c, x_scaled[~train_idx])
rows.append(
[
degree,
np.sqrt(np.mean((strength_exp[train_idx] - pred_train) ** 2)),
np.sqrt(np.mean((strength_exp[~train_idx] - pred_valid) ** 2)),
]
)
degree_df = pd.DataFrame(
rows, columns=["degree", "trainingRMSE", "verificationRMSE"]
)
display(degree_df.round(3))
plt.figure(figsize=(7.5, 4.2))
plt.plot(
degree_df["degree"], degree_df["trainingRMSE"], "o-", label="training"
)
plt.plot(
degree_df["degree"],
degree_df["verificationRMSE"],
"o-",
label="verification",
)
plt.title("Polynomial degree and generalization error")
plt.xlabel("degree of polynomials")
plt.ylabel("RMSE (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| degree | trainingRMSE | verificationRMSE | |
|---|---|---|---|
| 0 | 1 | 17.850 | 16.309 |
| 1 | 2 | 4.106 | 7.834 |
| 2 | 3 | 2.713 | 5.832 |
| 3 | 4 | 2.707 | 5.878 |
| 4 | 5 | 2.350 | 7.120 |
| 5 | 6 | 2.328 | 5.974 |
| 6 | 7 | 2.030 | 7.261 |
| 7 | 8 | 1.795 | 11.717 |

Interpreting the Results
Prefer a degree with low validation error and a model that is easy to explain and maintain. Here, degree 3 has the smallest validation RMSE. Because the result depends on the split, also use cross-validation, residual checks, and process knowledge to assess monotonicity and operating limits.
No.059: Interpolation Error
Practical Use
To use interpolation curves to determine operating conditions, it is necessary to measure “where and to what extent the curve deviates.” The error distribution serves as the basis for selecting the temperature for additional experiments.
Model and Method
For distinct nodes and a sufficiently smooth function, the degree- interpolation error has the form
In practice, higher derivatives are often unknown, so errors are directly measured at reserved verification points and compared with maximum absolute error and permissible errors for different applications.
Check with Python
validation_temp = np.arange(725, 900, 50, dtype=float)
validation_true = true_strength(validation_temp)
methods = {
"Lagrange": lag_poly(validation_temp),
"Natural Spline": spline(validation_temp),
"Quadratic least squares": np.polyval(coef_ls, (validation_temp - 800) / 100),
}
error_df = pd.DataFrame(
{
"temperature_℃": validation_temp,
**{name: pred - validation_true for name, pred in methods.items()},
}
)
display(error_df.round(3))
plt.figure(figsize=(8, 4.2))
for name in methods:
plt.plot(validation_temp, error_df[name], "o-", label=name)
plt.axhline(0, color="black", linewidth=1)
plt.axhspan(-5, 5, color="tab:green", alpha=0.12, label="Example: tolerance ±5 MPa")
plt.title("Estimation errors at held-out validation points")
plt.xlabel("set_temperature (℃)")
plt.ylabel("estimation error (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| temperature_℃ | Lagrange | Natural Spline | Quadratic least squares | |
|---|---|---|---|---|
| 0 | 725.0 | -0.506 | -0.603 | 4.521 |
| 1 | 775.0 | 0.235 | 0.125 | 6.789 |
| 2 | 825.0 | -0.235 | 0.304 | -0.162 |
| 3 | 875.0 | 0.506 | -1.540 | -3.511 |

Interpreting the Results
The validation temperatures are 725, 775, 825, and 875 °C, excluding every calibration node. At 775 °C, the quadratic least-squares error exceeds the illustrative ±5 MPa tolerance. Such regions are candidates for further measurements. Set actual tolerances from quality requirements and measurement uncertainty; passing these four points does not guarantee accuracy everywhere.
No.060: Difference from Regression
Practical Use
Interpolation, approximation, and regression are similar in that they draw curves, but their purposes differ. Incorrect use can change the conclusions of sensor calibration, process condition exploration, and quality explanation.
Model and Method
- interpolation: Pass through the observation point and form the values between points. Suitable for reference tables with small measurement errors.
- Approximation: Expresses complex functions and point clouds with easy-to-handle formulas. It emphasizes computational power, maximum error, and smoothness.
- Regression: Estimate the relationship between the objective variable and the explanatory variable, including probabilistic variation. Deals with coefficients, uncertainty, and forecasting.
Here, interpolation and least-squares regression are applied to experimental values including variation, and comparisons are made at unknown evaluation points.
Check with Python
interp_noisy = BarycentricInterpolator(temp_exp, strength_exp)
test_temp = np.linspace(710, 890, 73)
test_true = true_strength(test_temp)
test_interp = interp_noisy(test_temp)
test_reg = np.polyval(coef_ls, (test_temp - 800) / 100)
comparison_060 = pd.DataFrame(
{
"Methods": [
"Interpolation passing through all experimental points",
"2Least squares (regressive use)",
],
"training_RMSE_MPa": [0.0, np.sqrt(np.mean(resid**2))],
"validation_RMSE_MPa": [
np.sqrt(np.mean((test_interp - test_true) ** 2)),
np.sqrt(np.mean((test_reg - test_true) ** 2)),
],
}
)
display(comparison_060.round(3))
plt.figure(figsize=(8, 4.2))
plt.scatter(temp_exp, strength_exp, s=24, label="experimental value", color="tab:gray")
plt.plot(test_temp, test_interp, label="Noise interpolation", alpha=0.8)
plt.plot(test_temp, test_reg, label="Quadratic least squares", linewidth=2)
plt.plot(test_temp, test_true, "k--", label="True values for evaluation")
plt.title("Interpolation and regression at unseen points")
plt.xlabel("set_temperature (℃)")
plt.ylabel("tensile_strength (MPa)")
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.show()
| Methods | training_RMSE_MPa | validation_RMSE_MPa | |
|---|---|---|---|
| 0 | Interpolation passing through all experimental points | 0.000 | 61.922 |
| 1 | 2Least squares (regressive use) | 5.247 | 4.625 |

Interpreting the Results
Interpolation can reproduce measurement noise and have large errors at unseen points despite zero training error. Least-squares regression leaves training residuals but can estimate the underlying trend more reliably. Neither approach establishes causality without an appropriate experimental design and assessment of confounding.
Lessons from the Examples
- Choose methods based on your objectives: If you want to pass through reference points precisely, interpolation; if you want to get trends from noise, least squares and regression; for periodicity, Fourier approximation; and for trajectory shapes, Bézier curves.
- Smoothness and correctness are two different things.: Even a visually appealing curve does not guarantee the validity of values between nodes, ends, or extrapolations.
- Don’t look only at the mean error: Check the maximum error at the specification boundary and edge, as well as errors in the held-out data.
- Placement of measurement points is also a decision-making: Allocate additional tests to sections with large errors, large curvature, or high quality risks.
- Applying physical constraints to mathematical models: It is important not to ignore monotonicity, upper and lower limits, speed and acceleration, and operable range.
Putting the Methods into Practice
- Definition of Uses and Losses: Clearly define whether for display, control, or standard determination, and define losses caused by errors.
- Measurement system guarantee: Check gauge R&R, calibration history, and sampling conditions
- Verification Design: Conditions not used for learning or interpolation are withheld, and evaluation is performed not only by RMSE but also by maximum error and specification boundaries.
- Fixing the scope of application: Clearly indicate the interpolation range and implement warnings or computational stops when extrapolating
- Change management: Re-examine when equipment, ingredients, recipes, or measuring instruments are changed
- Operational Monitoring: Monitor input distribution and residuals, and establish criteria for relearning and recalibration.
Conclusion
From No.051 to No.060, we covered interpolation passing through a small set of points, approximation to normalize variation, dedicated basis representing periods and orbits, error verification, and differences from regression. In practice, what’s important is not creating the most complex curves, but designing the decision-making purpose, tolerance for error, scope of application, and verification methods as a set.
Business Inquiries
At Surikobo, we support in-house development for experimental planning, sensor calibration, process condition modeling, quality prediction, and numerical computations in manufacturing. You can consult on everything from method selection to data design, verification standards, and on-site operations.
📩 Contact Us: www.surikobo.co.jp/contact
Contact us to discuss your project.